Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- int main()
- {
- int triednum,luckynum,counter = 0;
- srand(time(NULL));
- luckynum = rand() % 100 + 1;
- printf("%d\n\n",luckynum);
- do
- {
- printf("Entre com o numero :\n");
- scanf("%d",&triednum);
- if (triednum>luckynum)
- {
- printf("O numero sorteado eh menor!\n\n");
- }
- if (triednum<luckynum)
- {
- printf("O numero sorteado eh maior!\n\n");
- }
- counter++;
- }while(triednum!=luckynum);
- printf("Parabens voce acertou!\nNumero de tentativas : %d",counter);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment