Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void main() {
- int ran, messo, max=9, tentativi=1;
- printf("Indovina il numero casuale tra 1 e %d!\n", max);
- srand(time(NULL));
- ran=rand()%max+1;
- scanf("%d", &messo);
- while(messo!=ran) {
- printf("Ahahah, pirla, hai sbagliato! Ritenta!\n");
- scanf("%d", &messo);
- tentativi++;
- }
- printf("Bravo, finalmente dopo %d tentativi hai indovinato!\n", tentativi);
- }
Advertisement
Add Comment
Please, Sign In to add comment