nikolas_serafini

Lista 3 - Exercício 7

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