1Answers
Four arithmetic operations in c language Why is the result of my operation incorrect?
Asked by: Hunter 141 views IT
Addition: void main(){ int a,b,z;char ch;printf("Please enter the expression:");scanf("%d%c%d",&a,&ch,&b);switch (ch){ case'+':z=a+b;break; case'-':z=ab;break; case'*':z=a*b;break; case'/':if(b) z=a/b;else printf("Divisor cannot be 0"); break;} printf("%d",z); return 0;}
+7Votes
The program runs without problems
Unless it is an input/output format that does not meet the requirements of the subject