
II-38 Programming Concepts
19.
void main()
{
float f=5/2;
clrscr();
printf("\n %f",f);
}
Bug: No bug. However, to get the desired output as 2.5, either 5 or 2 should be float
or explicit type casting is required.
20.
void main()
{
float d=65535.43;
double p=65789.987654;
clrscr();
printf("%d %d",d,p);
getche();
}
Bug: No bug. However, to get the desired output format provided is wrong. %f and %lf
are needed. Answer would be
65535.429688 65789.987654
21.
void main()
{
float d=1234567.43;
double p=987654321.1234567;
clrscr();
printf("\n%f %lf",d,p);
printf("\n%d %d",size of(d),size of(p));
getche();
}
Bug: Space between size and of should be removed. ...