Reginaldojs

exercicio 5,lista 3

Jun 14th, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<time.h>
  4. #define N 50
  5. int main(){
  6.     int sorteado;
  7.     srand(time(NULL));
  8.     int i=0;
  9.     while(i<=50){
  10.         sorteado=(rand()%100)+1;
  11.         printf("%d\t",sorteado);
  12.         i++;
  13.         }
  14.         printf("vamos ver agora com o for!\n\n");
  15.         for(i=0;i<=50;i++){
  16.                            sorteado=(rand()%100)+1;
  17.                            printf("%d\t",sorteado);
  18.                            }
  19.                            printf("agora com o do while!\n\n");
  20.                            i=0;
  21.                            do{
  22.                                sorteado=(rand()%100)+1;
  23.                                printf("%d\t",sorteado);
  24.                                i++;
  25.                                }
  26.                                while(i<=50);
  27.     system ("pause");
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment