C examples for Data Type:Type Cast
What happens when type casting is not leveraged during integer division.
#include <stdio.h> int main() /*from w w w . j a v a2 s .c o m*/ { int x = 12; int y = 5; printf("\nWithout Type-Casting\n"); printf("12 \\ 5 = %.2f\n", x/y); printf("\nWith Type-Casting\n"); printf("12 \\ 5 = %.2f\n", (float) x / (float) y); }