Hi there folks,
I got some minor problem with this code:
#include <stdio.h>
#include <stdlib.h>
int main(){
char option, factor;
printf("Choose your operator: \"+\" ; \"-\" ; \"*\" ; \"/\" \n>\t");
scanf(" %c", &option);
printf("You chose : %c \nChoose your factor:\n>\t", option);
scanf("%d", &factor);
printf("You chose : %i\n",factor);
printf(" %c", option);
if(option=='+'){
printf("It's WORKING!");
system("pause");
}
return 0;
}
and it doesn't work. Program skips "if()" as if it wasn't there and continues with "return 0;". On the other hand if I remove "scanf("%d", &factor);" it works prefectly fine!
Can anyone tell me why?
regards