Probably a basic question, but...
I don't understand how I could make a program repeat itself.
The entire program, or most of for at least.
This is the program:
Code:
#include <stdio.h>
int main()
{
int x;
printf("Please guess the Number.\n The number is under 120.\n ");
scanf( "%d", &x );
getchar();
if ( "%d", x != 90 ) {
printf("You entered %d . This number is wrong. Press enter to continue.", x );
getchar(); }
else {
printf("You found out the number! Press enter to continue. ", x );
getchar();
}
return 0;
}
I just need a way to make the program ask you to guess the number until you eventually guess it.
BTW this is just a random proof project, something to prove to myself I know what I'm doing, which apparently I'm not.
I understand I might be able to implement this with while, for, or do..while, but I don't understand who I could implement that.
Any help/solutions would be appreciated!