i was trying to make a calculator in C. I wrote that code
#include <stdio.h>
int main()
{
char proc;
float x,y,z;
printf("Enter the proccess you need to do :\nA) +\nB) -\nC) *\nD) /\n>>> ");
scanf("%c", &proc);
if (proc !='A' || proc !='a' || proc !='B' || proc !='b' || proc !='C' || proc !='c' || proc !='D' || proc !='d' )
{
printf("enter a valid charecter.\n");
return 0;
}
else
printf("Enter your first number: ");
scanf("%f", &x);
printf("Enter your seconde number: ");
scanf("%f", &y);
//Start of IF statment
if (proc =='A' || proc == 'a')
{
z = x+y;
printf("The sum is %.2f:\n",z);
}
else if (proc =='B' || proc == 'b')
{
z = x-y;
printf("The sum is %.2f:\n",z);
}
else if (proc =='B' || proc == 'b')
{
z = x*y;
printf("The sum is %.2f:\n",z);
}
else if (proc =='B' || proc == 'b')
{
z = x/y;
printf("The sum is %.2f:\n",z);
}
else printf("Enter a valid charecter.\n");
//End of IF statment
return 0;
}
but when i try to run it and try for example A it show "enter a valid character." which i need it if i type non of these chars A,B,C,D also in lower case . Did i do it in a wrong way ?