How to take unlimited input in calculator in C coding? calculator ex:12+38-7+88*7 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to take unlimited input in calculator in C coding? calculator ex:12+38-7+88*7

21st Jul 2022, 8:01 AM
Ishfak Afiq
Ishfak Afiq - avatar
4 Answers
0
Ishfak Afiq such an input is possible. Take input as a string. Then store the numbers in an array by iterating over the string. If you want it to be like a calculator... Then in a loop( iterating over the string) , check for the operators (+,-,*,etc.) and based on if conditions or switches do the appropriate action the adjacent/numbers beside the operators numbers and continue the loop till it reaches the last number.
21st Jul 2022, 12:29 PM
Bhaveshsingh Pawar
Bhaveshsingh Pawar - avatar
+ 2
calculator ex:12+38-7+88*7
21st Jul 2022, 8:26 AM
Ishfak Afiq
Ishfak Afiq - avatar
+ 1
What do you mean in „unlimited input“? Could you show a few examples?
21st Jul 2022, 8:24 AM
JaScript
JaScript - avatar
0
Send code
21st Jul 2022, 12:31 PM
Ishfak Afiq
Ishfak Afiq - avatar