Warning: implode(): Invalid arguments passed in /www/wwwroot/jobquiz.info/mdiscuss.php on line 336 What will be the output of the program? #include<stdio.h> int main() { float a=0.7; if(a < 0.7f) printf("C\n"); else printf("C++\n"); return 0; } ?->(Show Answer!)
1. What will be the output of the program? #include<stdio.h> int main() { float a=0.7; if(a < 0.7f) printf("C\n"); else printf("C++\n"); return 0; }
Ask Your Doubts Here
Comments
By: guest on 01 Jun 2017 06.01 pm
if(a < 0.7f) here a is a float variable and 0.7f is a float constant. The float variable a is not less than 0.7f float constant. But both are equal. Hence the if condition is failed and it goes to else it prints 'C++'
Example: #include<stdio.h> int main() { float a=0.7; printf("%.10f %.10f\n",0.7f, a); return 0; } Output:
0.6999999881 0.6999999881
Example: #include<stdio.h> int main() { float a=0.7; printf("%.10f %.10f\n",0.7f, a); return 0; } Output:
0.6999999881 0.6999999881