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

25th Jun 2022, 1:57 PM
Rhishith S
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..
25th Jun 2022, 2:43 PM
Jayakrishna 🇮🇳
25th Jun 2022, 2:15 PM
Rhishith S
+ 2
Try this compiler it works better. https://www.tutorialspoint.com/compile_c_online.php
25th Jun 2022, 4:01 PM
Chris Coder
Chris Coder - avatar
+ 2
It's working thanks
26th Jun 2022, 3:08 AM
Rhishith S
+ 1
2nd printf is not working how do i put number for else if statement to run properly
25th Jun 2022, 2:19 PM
Rhishith S
+ 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 🥲
25th Jun 2022, 2:25 PM
Rhishith S
+ 1
Sololearn's code playground takes all inputs at once.
25th Jun 2022, 3:56 PM
Chris Coder
Chris Coder - avatar
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?
25th Jun 2022, 2:07 PM
Jayakrishna 🇮🇳