0
Why character is not come to my code.? I want to input operator bycharacter.
#include <stdio.h> main() { float a,b, result; char op; printf("first number ="); scanf("%f",&a); printf("Enter the operator= %c ",op); scanf("%c",&op); printf("\nsecond number="); scanf("%d",&b); return 0; }
1 Answer
+ 2
You try to output 'op' before scanning for it ('Enter...'). If you move The output under scanning for it, it should work!