nikolas_serafini

Lista 3 - Exercício 6

Jun 11th, 2013
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int main()
  6. {
  7.     int i,val,low,high,num;
  8.     srand(time(NULL));
  9.  
  10.     printf("Entre com a quantidade de numeros a serem sorteados :\n");
  11.     scanf("%d",&num);
  12.     printf("Entre com o numero maximo e minimo do intervalo :\n");
  13.     scanf("%d %d",&low,&high);
  14.  
  15.     for (i = 0; i < num; i++)
  16.     {
  17.         val = rand() % (high - low) + low;
  18.         printf("%d\n",val);
  19.     }
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment