Saturday, 10 December 2011

Write a program convert float to int in c

#include
#include
main()
{
float x,y,z;
clrscr();
x=10.898;
y=21.777;
z=x+y;
printf("\n %f",z);
z=(int)x+y;
printf("\n %f",z);
z=(int)(x+y);
printf("\n %f",z);
getch();
}


OUTPUT
32.674999
31.777000
32.000000

No comments:

Post a Comment