Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
C_141126_ArrayMayorMenor02
//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 imayor, imenor; 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(imayor = imenor = 0 , i = 1 ; i < _T ; i++) { if(v[imayor] < v[i]) { imayor = i; } if(v[imenor] > v[i]) { imenor = i; } } printf("\n\n\n"); printf("Valor mayor: %ld (%ld)\n", v[imayor], imayor); printf("Valor menor: %ld (%ld)\n", v[imenor], imenor); printf("\n\n\n"); return 0; }
run
|
edit
|
history
|
help
0
funciones serie de taylor
CO_assign_q4
NO OF NODES IN LINK LIST
C_141204_ValorNumerico
convertletter
Conflito de Escrita em Matriz
PRACTICE 1
Sum Two Numbers
Homework 2 Code
FunPointTeleBook