/*C Program to use of type cast*/
#include<stdio.h>
main()
{
int
total_cost=575,qty=24;
float cost_item;
/*without type
casting*/
cost_item=total_cost/qty;
printf("\n
Cost of one item without type casting is %f",cost_item);
/*with type
casting*/
cost_item=total_cost/(float)qty;
printf("\n
Cost of one item with type casting is %f",cost_item);
}
No comments:
Post a Comment