+ 2
Why I can't get the output
#include <stdio.h> #include<stdlib.h> int main() { int a,b,c,sum; printf("enter two numbers\n"); scanf("%d%d",&a,&b); printf("enter 1 for addition\nenter 2 for substraction\nenter 3 for multiplication\nenter 4 for division"); scanf("%d",&c); if(c==1){ sum=a+b; } else if(c==2){ sum=a-b; } else if(c==3){ sum=a*b; } else if(c==4){ sum=a/b; } else { printf("fool"); } printf("result=%d",sum); return 0; }
8 Answers
+ 2
Rhishith S
If you are running this in SL playground then it's not an interactive one. When the popup window appears, you need to give all required inputs by space separated or line by line at once only....
Ex: your program needs 3 inputs then
4 3 2
Or
4 (enter)
3 (enter)
2 (submit)
You can see your output..
+ 2
Try this compiler it works better.
https://www.tutorialspoint.com/compile_c_online.php
+ 2
It's working thanks
+ 1
2nd printf is not working how do i put number for else if statement to run properly
+ 1
After I declare two variables there is no other window is popping out I don't get what is the problem here. I am using this app on mobile is it have anything to do with the outcome š„²
+ 1
Sololearn's code playground takes all inputs at once.
0
Mention your trouble with it clearly..
Better to save code and share link here.. That's helps debug easily..
Code looks fine.. What are your inputs?