pierovdfn

Giochino

Jul 18th, 2011
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void main() {
  5.     int ran, messo, max=9, tentativi=1;
  6.     printf("Indovina il numero casuale tra 1 e %d!\n", max);
  7.     srand(time(NULL));
  8.     ran=rand()%max+1;
  9.     scanf("%d", &messo);
  10.     while(messo!=ran) {
  11.         printf("Ahahah, pirla, hai sbagliato! Ritenta!\n");
  12.         scanf("%d", &messo);
  13.         tentativi++;
  14.     }
  15.     printf("Bravo, finalmente dopo %d tentativi hai indovinato!\n", tentativi);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment