+ 4

Is this a valid way to declare variables?

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

21st Jan 2021, 5:09 PM
Sagor Mahmud
3 Answers
+ 3
Your code is fine. But; b may equals zero so you cannot do a division by zero! (Use an if statement here ) The variable div will give you an int so the decimal part is missed(it's your choice here)
21st Jan 2021, 10:50 PM
Hisham YUM šŸ‡²šŸ‡¦
Hisham YUM šŸ‡²šŸ‡¦ - avatar
+ 2
Thanks, Hisham YUM šŸ‡²šŸ‡¦
22nd Jan 2021, 2:39 AM
Sagor Mahmud
+ 1
Welcome šŸ‡§šŸ‡©Mohammad SagoršŸ‡§šŸ‡© ! If you got your right answer, do not for forget to mark it as the best one šŸ˜‰ Have a good day!
22nd Jan 2021, 2:43 AM
Hisham YUM šŸ‡²šŸ‡¦
Hisham YUM šŸ‡²šŸ‡¦ - avatar