Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
C_141126_ArrayMayorMenor01
//Title of this code #include <stdio.h> #include <stdlib.h> #include <time.h> #define _T 100 int main(void) { long v[_T]; long i; long a, b; long mayor, menor; printf("Valor de a ... "); scanf(" %ld", &a); printf("Valor de b ... "); scanf(" %ld", &b); if(a > b) { a ^= b; b ^= a; a ^= b; } for(srand(time(NULL)) , i = 0 ; i < _T ; i++) { v[i] = a + rand() % (b - a + 1); } printf("\n\n"); for(i = 0 ; i < _T ; i++) { if(i % 10 == 0 && i) { printf("\n"); } printf("%6ld", v[i]); } for(mayor = menor = v[0] , i = 1 ; i < _T ; i++) { if(mayor < v[i]) { mayor = v[i]; } if(menor > v[i]) { menor = v[i]; } } printf("\n\n\n"); printf("Valor mayor: %ld\n", mayor); printf("Valor menor: %ld\n", menor); printf("\n\n\n"); return 0; }
run
|
edit
|
history
|
help
0
Spring 2017 Project 2 v1
jar.exe
etapa final de pregunta 2
150109_RecursividadPrimo
Primer avance de lista enlazadas
CPTTRN_2
Print Bash Version.c
Project 5 v.05
Avance 2 de pregunta 5
Pointer arithmatic