why my code isn't working ..i have made a calculator earlier using switch...but now i want it to work using if statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why my code isn't working ..i have made a calculator earlier using switch...but now i want it to work using if statement

https://code.sololearn.com/cG87ik7AVCgi/?ref=app

1st Apr 2017, 5:08 PM
Laraib
Laraib - avatar
3 Answers
+ 1
Syntax error @ if(op='+') u should use == for comparison. if(op=='/')
1st Apr 2017, 5:17 PM
Eranga
Eranga - avatar
+ 1
You are doing an assignment in the if statements, not a comparison, use == instead of =. Also use more else, currently the error gets triggered when the user enters any operator besides '/'
1st Apr 2017, 5:21 PM
Dennis
Dennis - avatar
0
thanks guys...,its working now
1st Apr 2017, 5:19 PM
Laraib
Laraib - avatar