When I run the following program , after loop it outpur "Enter Valid Number". How can I solve this problem?
``````#include <stdio.h>
#include <conio.h>
#include <string.h>

void main()
{
int var1,var2,sum;
char Choise;

while (Choise!='q'){
printf("\n(1)A-Add two integers.\n\n(2)C-compart two integers for the larger.\n\n(3)F-Test an integers for odd or even.\n\n(4)Q-Quit.\n\n");
scanf("%c",&Choise);
strlwr(&Choise);

clrscr();
switch(Choise)
{
case 'a':
printf("\n\t\tSUM OF TWO INTEGERS\nEnter Number1: ");
scanf("%d",&var1);
printf("\nEnter Number2: ");
scanf("%d",&var2);
printf("\n\nSum = %d",var1+var2);
break;
case 'c':
printf("\n\t\tCOMPARISION BETWEEN TOW INTEGERS\nEnter A: ");
scanf("%d",&var1);
printf("\nEnter B: ");
scanf("%d",&var2);
if (var1>var2)
printf("\n\nA > B",var1,var2);
else if(var2>var1)
printf("\n\nB > A",var2,var1);
else
printf("\n\nA = B",var1,var2);
break;
case 'f':
printf("\n\t\tODD OR EVEN\nEnter Any Number : ");
scanf("%d",&var1);
if((var1%2)==0)
printf("\n\n%d is even",var1);
else
printf("\n\n%d is odd",var1);
break;
case 'q':

default:
printf("\nEnter valid choise :");

}
getch();
clrscr();
}
}
``````

The "how to post code" seems to be eluding your attention.

As a result, your post is eluding our attention.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.