C language: ex: c*9/5+32; if I give in input screen "5" gives 41.0000 float result! how it takes this result? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

C language: ex: c*9/5+32; if I give in input screen "5" gives 41.0000 float result! how it takes this result?

help understand calculate

22nd Apr 2017, 1:49 PM
Nasibillo Muhamedov
Nasibillo Muhamedov - avatar
9 Answers
+ 20
The result seems okay, it's supposed to be 41.
22nd Apr 2017, 2:07 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 10
sorry i can't C.
22nd Apr 2017, 1:51 PM
Agus Mei
Agus Mei - avatar
+ 8
there is no C language course in Sololearn and now i am focusing on python and ruby. remember the Filip's books, i am reading it now. about xp, it came from challenge, course, illuminati badge, code badge and moderator badge. and don't forget best answer mark poin. https://www.sololearn.com/discuss/204501/?ref=app
22nd Apr 2017, 2:05 PM
Agus Mei
Agus Mei - avatar
+ 5
Since * and / have same precedence, operator coming first in the expression is solved first. Taking your value and given value 5, we get =5*9/5+32 =45/5+32. =9+32 =41
22nd Apr 2017, 2:05 PM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar
+ 5
I think you wrote float ans = c*9/5+32; thats why answer is in float.
22nd Apr 2017, 2:09 PM
Cyrus Ornob Corraya
Cyrus Ornob Corraya - avatar
+ 4
Thanks Devender Mahajan understand me only
22nd Apr 2017, 3:16 PM
Nasibillo Muhamedov
Nasibillo Muhamedov - avatar
+ 2
why you so many xp you got, ! where from they are?
22nd Apr 2017, 1:53 PM
Nasibillo Muhamedov
Nasibillo Muhamedov - avatar
+ 2
arenot you interested on C? or not need
22nd Apr 2017, 1:55 PM
Nasibillo Muhamedov
Nasibillo Muhamedov - avatar
22nd Apr 2017, 2:05 PM
Calviղ
Calviղ - avatar