| Current Path : /var/www/html/bibhas.ghoshal/ITP_2019/lab/ |
| Current File : /var/www/html/bibhas.ghoshal/ITP_2019/lab/prog7.c |
#include <stdio.h>
int main(void)
{
float pi1 = 3.142, pi2 = 0.3142E1 ,pi3 = 3142E-3;
float float_x = 12345.678901234567890; /* 20 significant digits */
double double_y = 12345.678901234567890; /* same */
float sensex1 = 25341.86;
float sensex2, gain;
printf("pi1 = %f, pi2 = %e, pi3 = %g\n", pi1,pi2,pi3);
printf("float_x = %.15f\n",float_x);
printf("double_y = %.15f\n",double_y);
/* Uncomment these 2 lines if your computer supports long double */
/* long double ldouble_z = 12345.678901234567890;
printf("ldouble_z = %.20LF\n", ldouble_z); */
printf("Enter today's value of Sensex: ");
scanf("%f",&sensex2);
gain = (sensex2 - sensex1) / sensex1 * 100;
printf("Sensex returns since March 31,2016 : %f%%\n",gain);
return 0;
}