C examples for Data Type:Type Cast
How truncation works and how integer division differs from floating-point division.
#include <stdio.h> int main(void) { printf("integer division: 5/4 is %d \n", 5/4); printf("integer division: 6/3 is %d \n", 6/3); printf("integer division: 7/4 is %d \n", 7/4); printf("floating division: 7./4. is %1.2f \n", 7./4.); printf("mixed division: 7./4 is %1.2f \n", 7./4); /*from w ww . j av a 2s . c om*/ return 0; }