Hay guys iam new to c programming and i was trying to do simple do you want to continue loop using do while loop
the problem is the program doesn't read the char Y/N and just simply contiune the loop and here is the code
what's wrong
#include <stdio.h>
#include <conio.h>
int main()
{
int x;
char answer;
do{
printf("Please enter a number : ");
scanf_s ("%d", &x);
if ((x % 2) != 0) printf("\nThe number is odd\n");
else printf("The number is even\n");
printf("Do you want to continue (Y / N )? ");
scanf_s ("%c", &answer);
} while (answer != 'N');
_getch();
}