+ 2

is there a way to turn a string with numbers and operators into an answer for the mathmatical equation in the string in C

i have a string like str ("300 / 400") the answer should be 0.750 . how can it be done in the C language ?

13th Apr 2019, 2:37 PM
Anas Seh
Anas Seh - avatar
1 Answer
0
You can use the sscanf() function to parse the string and extract the operands and operator, then perform the calculation based on the extracted values and switch statement to handle different operators. Here is the code⤵️ https://sololearn.com/compiler-playground/cXcpCgYXegkU/?ref=app
12th Apr 2024, 1:36 PM
`ᴴᵗᵗየ
`ᴴᵗᵗየ - avatar