Data Type MCQ 1 : Comparing Floating Point Value with Double in C
In C Programming (Multiple Choice Question 1 ) Comparing Floating Point Value with Double
#include<stdio.h> void main() { float num1 = 1.1; double num2 = 1.1; if(num1==num2) printf("Stanford"); else printf("New Delhi"); }
Options :
- Stanford
- New Delhi
- Compile Error
- Run Time Error
Why & How ?
- Float store floating point numbers with 8 place accuracy
and requires 4 bytes of Memory. - Double has 16 place accuracy having size of 8 bytes
- For floating point numbers (float, double, long double) the values cannot be predicted exactly.