C Programming Tutorial – 9 – int or float ? :

Note:

  • // int just shows the integer part of the number
  • // float shows the integer and decimal part of the number:

Code:
—————————

#include <stdio.h>
#include <stdlib.h>

int main()
{

int a=86;                                            // Int just shows the integer part of the number
int b=21;
printf(“%d\n”, a/b);
float c=86.0;                                     // float shows the integer and decimal part of the number
float d=21.0;
printf(“%f\n”, c/d);

return 0;

}