In this program i can take two integers but cannot take char as input.. what shuold i do in this situation to take both int and char? i would like to make a simple calculator where i can choose the operator such as +,-,/,* to perform calculation.
#include <stdio.h>
#include <stdlib.h>
//Adding two real numbers using character type variable
int main()
{
int a,b,c;
char ch;
printf("Enter two number: \n");
scanf("%d %d", &a,&b);
ch=getchar();
if((ch=='+')){
c=a+b;
printf("%d", c);
}
else{
printf("wrong!");
}
return 0;
}
`