int main()
{
  char Operator;
  int num1, num2, result;
 /* printf("Enter operator: ");
  scanf("%c", &Operator);*/
  printf("Enter first and second value: ");
  scanf("%d %d", &num1, &num2);
  printf("Enter operator: ");
  scanf("%c", &Operator);
  if(Operator == '+')
  {
    result = num1 + num2;
    printf("%d\n", result);
  }
  else if(Operator == '-')
  {
    result = num1 - num2;
    printf("%d\n", result);
  }
  return 0;
}
I tried making a simple calculator, and I put scanf(the one that requests an Operator) where it is now, and it does not work. But if I put it where the comment is, above the "Enter first and second value" it then works. I would just like to know why does it work on one place and not the other. Thanks in advance.
 
     
    