#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; }
6/25/2022 1:57:51 PM
Rhishith S8 Answers
New AnswerRhishith 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..
Try this compiler it works better. https://www.tutorialspoint.com/compile_c_online.php
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 🥲
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?
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message