ProgIng - Programación en Ingeniería
Loading...
Searching...
No Matches
Ejemplo011.c
Go to the documentation of this file.
1#include<stdio.h>
2#include<stdlib.h>
3#include<time.h>
4
5int main(int argc, char*argv[])
6{
7 int i, n, max, min, x, aux;
8 srand(time(NULL));
9 do{
10 printf("Ingrese el numero de elementos: ");
11 scanf("%d", &n);
12 }while(n<1);
13 printf("Ingrese el valor maximo: ");
14 scanf("%d", &max);
15 printf("Ingrese el valor minimo: ");
16 scanf("%d", &min);
17 if(min>max)
18 {
19 aux = max;
20 max = min;
21 min = aux;
22 }
23 for(i=0; i<n; i++)
24 {
25 x = rand()%(max-min+1)+min;
26 printf("%d. %d\n", i+1, x);
27 }
28 return 0;
29}
#define max
#define min
int main(void)
Definition Ejemplo_035.c:15