Problem in switch statement how to assign a value to the variable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Problem in switch statement how to assign a value to the variable

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

17th Sep 2020, 8:57 AM
Shubhankar Anand
Shubhankar Anand - avatar
4 Answers
+ 2
There were a lot of minor errors. ▪ There is no variable 'l' declared but you have used it. ▪ It should be 'Math' and not 'Maths'. ▪ You have misspelled println in case 'h'. ▪ All the case should be replaced with strings. ▪ Also Math.sqrt() returns a double so you must type cast it to (int). Give input as- 10 20 Area Here is your modified code. https://code.sololearn.com/cCK6usSj1L16/?ref=app
17th Sep 2020, 9:13 AM
Avinesh
Avinesh - avatar
+ 4
You forget to write colon in case it should be case i: And your variable l are undecleared and some other errors try to fix one by one
17th Sep 2020, 9:05 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Thankyou very much friends
17th Sep 2020, 9:23 AM
Shubhankar Anand
Shubhankar Anand - avatar
0
But we could also change the data type of f to double
17th Sep 2020, 9:37 AM
Shubhankar Anand
Shubhankar Anand - avatar