ProgIng - Programación en Ingeniería
Loading...
Searching...
No Matches
Ejemplo011.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
Include dependency graph for Ejemplo011.c:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 5 of file Ejemplo011.c.

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