C Program to Format the Number
Write C Program to User of Formatting the Number
#include<stdio.h>
int main()
{
float n;
printf("Enter the floating point number :--> ");
scanf("%f",&n);
printf("The floating point number is : %f",n);
//display 2 digit after decimal
printf("\nThe floating point number is : %0.2f",n);
//display 4 digit after decimal in width of 10 & right align
printf("\nThe floating point number is : %10.4f",n);
return 0;
}
Output:
Enter the floating point number :--> 56
The floating point number is : 56.000000
The floating point number is : 56.00
The floating point number is : 56.0000