Floating Point Check | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Floating Point Check

In this code , if we give (1/2)*m*n whatever may be the input , the answer will be zero because the computer executes (1/2) as zero.That is because the variable is of integer.If we give it as (1.0/2.0) , we will get the exact output.Now it works because they are in floating type. Hope this helps you...!!! https://code.sololearn.com/cyqsLG6jwnb9/?ref=app

30th Jan 2018, 3:31 AM
Uvan Sankar
Uvan Sankar - avatar
2 Answers
+ 17
30th Jan 2018, 3:37 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 3
tk u @gaurav
30th Jan 2018, 6:49 PM
Uvan Sankar
Uvan Sankar - avatar