I am a real newbie to the forum and to C programming. I just started learning a week ago. This is my first try at a program and I have something wrong and I can not figure it out. I know it will be something simple but I can not find it.
would you please take a look at it and give some pointers on what I am doing wrong. Beside it being slopy code, and probably not to efficient. Why will it not loop ?
Here is my code:
/* This is a guessing game. You try to guess what the magic number is.
You get 10 tries or guess the right number before the game terminates.
Then the game terminates and tell you how may right and wrong answers
that you had. */
int right ; // Declare the variables
int wrong ;
int magicnum =123;
int guess ;
int tries ;
int i = 1;
printf(" Try to guess the magic number\n");
for(i=0 ; i<11 && guess!=magicnum ; i++);
printf(" Enter your guess.\n");
printf(" It took %d try.\n", tries );
if(guess > magicnum)
printf(" Your number was too high.");
printf("Wrong !\n Your number is too low !\n");
printf(" It took %d tries.\n", tries);
printf(" You had %d right and %d wrong !\n", right, wrong);
printf("The program will now terminate !");