Monday, 8 December 2014

Example program for floating point values
#include<stdio.h>
#include<stdlib.h>
main()
{
int a=100,b=20;
float c,c1,c2,c3;
c=a/b;
printf("%f\n",c);
c1=(float)a/(float)b;
printf("%f\n",c1);
c2=(float)a/b;
printf("%f\n",c2);
c3=a/(float)b;
printf("%f\n",c3);
printf("%d\t%d\n",a,b);
}
OutPut:
madan@madan-Lenovo-G570:~/madan$ cc ex37.c
madan@madan-Lenovo-G570:~/madan$ ./a.out
5.000000
5.000000
5.000000
5.000000
100 20