I don't know what is wrong with these code can any one help me with that ..... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I don't know what is wrong with these code can any one help me with that .....

Can any one help me with these swite condition Everything is almost right but something is wrong with these https://code.sololearn.com/cmpnOKhQc6e3/?ref=app https://code.sololearn.com/cmpnOKhQc6e3/?ref=app

16th Jun 2022, 6:25 PM
Rustam Singh Sahu
Rustam Singh Sahu - avatar
7 Answers
+ 4
What are your inputs? sample!!? edit: Rustam Singh Sahu before scanf for char, just put getchar(); to consume white space.....
16th Jun 2022, 6:36 PM
Jayakrishna 🇮🇳
+ 3
Andrés Sebastián López You can, you just need to make sure they're all on a seperate line such as by pressing the enter key after each input.
16th Jun 2022, 6:43 PM
Justice
Justice - avatar
+ 1
I tried it to many c compiler but output is wrong btw I'm beginner thanks for the help
16th Jun 2022, 7:13 PM
Rustam Singh Sahu
Rustam Singh Sahu - avatar
0
Justice, I had never realized that.. Thanks!!
16th Jun 2022, 7:05 PM
Andrés Sebastián López
Andrés Sebastián López - avatar
0
Andrés Sebastián López No problem! The same happened with me. It's very different from typical IDE behavior when using the command line.
16th Jun 2022, 7:46 PM
Justice
Justice - avatar
0
c code really works in a stream though. So you can enter as many inputs needed on one line as long as the scan is correct. or use jaykrishna's getchar() suggestion. But i just tried and input: 2 3+ and it worked just fine. Notice how there's no white space in between the second number and the operator
16th Jun 2022, 8:18 PM
Slick
Slick - avatar
- 1
Are you trying to run it in the Sololearn app? I don't know if you could do this because the app doesn't let you introduce more than one input, at least when I tried to do a program with multiple inputs, I couldn't test it..
16th Jun 2022, 6:41 PM
Andrés Sebastián López
Andrés Sebastián López - avatar