Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int randomnum, num;
- int attempts = 1;
- randomnum = 1 + rand() % 99;
- printf("Enter a number between 1 and 100\n\n");
- printf("Enter a zero when complete\n\n");
- do
- {
- scanf("%i" ,&num);
- printf("Number %i = %i:", attempts , num);
- srand(time(NULL));
- printf("The random number is %d.\n\n", randomnum);
- attempts = ++attempts;
- if(num == randomnum)
- {
- printf("\n\nYou did it!\n\n");
- if (attempts == 1)
- {
- printf("Awesome Job!");
- }
- else if (attempts <= 2 && <= 5)
- {
- printf("Great Job!");
- }
- else if (attempts <= 6 && <= 9)
- {
- printf("Good Job!");
- }
- else if (attempts <= 10 && <= 13)
- {
- printf("OK Job!");
- }
- else (attempts > 13)
- {
- printf("You're too Slow!");
- }
- }
- else if(num < randomnum)
- {
- printf("\n\nToo Low!\n\n");
- }
- else
- {
- printf("\n\nToo High!\n\n");
- }
- }while(num != 0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement