ramontricolor12

LISTA 03 - Exercício 07

Jun 15th, 2013
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int main()
  6. {
  7.     int num, gerador, i;
  8.  
  9.     srand(time(NULL));
  10.     printf("\nInforme um numero de 1 a 10: ");
  11.     scanf("%d", &num);
  12.  
  13.     gerador = rand() % 10;
  14.  
  15.     if(num == gerador)
  16.     {
  17.         for(i = 0; i < 100; i++)
  18.             printf("\nQue Sorte!!");
  19.     }
  20.  
  21.     else
  22.         printf("\nErrado, o numero sorteado foi %d\n", gerador);
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment