Why character is not come to my code.? I want to input operator bycharacter. | SoloLearn: Learn to code for FREE!

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; }

6/1/2020 10:12:50 AM

Abhishek Kumar

1 Answer

New Answer

+2

You try to output 'op' before scanning for it ('Enter...'). If you move The output under scanning for it, it should work!