0
why does it print "Good" when we input s=3.6????
#include<stdio.h> int main(){ float s; scanf("%f",&s); if(s>=3.6) printf("Excelent"); else printf("Good"); return 0; }
2 Antworten
+ 4
Float precision
Read this article about comparing float value in c language.
https://www.geeksforgeeks.org/comparison-float-value-c/
+ 2
3.6 float is 3.59999...
And you're comparing it to
3.6 double (3.60000...)