Thursday, December 25, 2008

Float Data Type Questions with Answers in C Programming

Q1. What will be output:

void main()
{
float a=5e40;
clrscr();
printf("%f",a);

getch();
}
Output: +INF

Explanation: 5e40 is beyond the range of float so output is plus infinity

Q2.What will be output:
void main()
{
float a=5e4;
clrscr();
printf("%f",a);

getch();
}
output :50000.000000
Explanation: 5e4 is in exponential form is (5*10^4)

No comments:

Blog List