Sunday, November 23, 2008

FLOAT DATA TYPE Questions with Answers

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
(10)
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