I have created a program to check if a number is even or odd.
But in this ' scanf("%c",&choice); ' is not working. Could not understand why?
#include<stdio.h>
int main()
{
int a;
char choice='y';
for(a=1;choice=='y';a++)
{
printf("enter a number to check whether it is even or odd\n");
scanf("%d",&a);
if(a%2==0)
{
printf("the no. is even\n");
}
else
{
printf("the no. is odd\n");
}
printf("\nto check more y for yes and n for no\n");
scanf("%c",&choice);
}
return 0;
}