Write a program to print the value 345.6789 in fixed-point format with the following specifications:
(a) correct to two decimal places;
(b) correct to five decimal places; and
(c) correct to eight decimal places.
#include <stdio.h>
void main()
{
double a=10.45678;
printf("%.2e\n",a);
printf("%.4e\n",a);
printf("%.8e\n",a);
getch();
}
(a) correct to two decimal places;
(b) correct to five decimal places; and
(c) correct to eight decimal places.
#include <stdio.h>
void main()
{
double a=10.45678;
printf("%.2e\n",a);
printf("%.4e\n",a);
printf("%.8e\n",a);
getch();
}
No comments:
Post a Comment