How to create a calculator in C | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

How to create a calculator in C

Explaine me someone please, how can I write a simple calculator in C compliler. I need to input data and to get output. I did addition/substraction, but multiplication/division i can not understand how to do! https://code.sololearn.com/c4gHWXu8HLws/?ref=app

30th May 2019, 11:10 PM
Zolo89
Zolo89 - avatar
4 Antworten
+ 3
Probably the same way you did addition and subtraction, just change the sign.
30th May 2019, 11:13 PM
Bodan Talev
Bodan Talev - avatar
+ 2
I just saw your code. Why not use a switch statement? Here's an example in C++: https://code.sololearn.com/cfCHxWHE4C87/?ref=app
30th May 2019, 11:16 PM
Bodan Talev
Bodan Talev - avatar
0
Unfortunately no! When I do the same way, i do not get anything
30th May 2019, 11:14 PM
Zolo89
Zolo89 - avatar
0
Okay! Just, when I did the similar way in java it worked, but not in C. I thought it will be worked in C as well.
30th May 2019, 11:20 PM
Zolo89
Zolo89 - avatar