hey guys, i'm rather new to c prog so any advice will be appreciated.
this prob may be rather elmentary but i'm still having probs, pls help!
ok, so the prob goes like this:
Write a loop to repeatedly perform a computation to add 2 integers.
The users will be prompted with "do u wanna con't?"and if he enters a y or Y, the prog will start again.if the user enters anything else, the prog terminates..
ok, my version goes like this:
int num1, num2, num3;
printf ("enter 2 integers");
scanf ("%d%d", &num1, &num2);
num3 = num1 +num2;
printf ("The ans is %d", num3");
printf ("wanna play again?");
scanf ("%c", &ans);
while (ans == 'y' || ans == 'Y');
it does not work tho=(
it computes the answer perfectly, but it does not seem to let the user key in a y/n answer...it just prints the "wanna play again" and then the whole prog terminates...
Help please!!why does this happen?