Hello can you help me,i have problem of this if i will use scanf("%c",&repz);
my porgram will exit it will not loop to menu..but if i will change to %s this will loop to menu...but i declare variable repz as char...can you help me or explain on this why it will loop if i will use %s and not %c...thank you in advance hoping for your positive responds...
#include<stdio.h>
int main()
{
int num1=0;
int num2=0;
int answer=0;
int select=0;
char repz;
do{
clrscr();
do
{
printf("======MENU========");
printf("\n1. ADDITION");
printf("\n2. SUBTRACTION");
printf("\n===================");
printf("\nSelect your choice: ");
scanf("%d",&select);
}while(select > 2 || select <= 0 );
printf("\nInput num1: " );
scanf("%d",&num1);
printf("Input num2: ");
scanf("%d",&num2);
if(select==1)
{
printf("\nAddition");
answer= num1+num2;
}
else
{
printf("subtraction");
if(num1>num2)
{
answer=num1-num2;
}
else
{
answer= num2-num1;
}
}
printf("\nThe answer: %d" ,answer);
printf("\nDo you want to continue Y/N?: ");
scanf("%s",&repz);
repz=toupper(repz);
if(repz=='N')
exit(0);
}
while(repz=='Y');
getch();
}
[LIST=1]
[/LIST]