Get the input(N) as float number from the user and display the numbers in one, two and three digit floating numbers as displayed in sample output. Input format A float number (N). Output format One digit floating number Two digit floating number Three digit floating number. Sample testcases Input 1 12.2345
Get the input(N) as float number from the user and display the numbers in one, two and three digit floating numbers as displayed in sample output.
Input format
A float number (N).
Output format
One digit floating number
Two digit floating number
Three digit floating number.
Sample testcases
Input 1
12.2345
OUTPUT
#include<stdio.h>
#include<stdlib.h>
int main()
{
double number;
scanf("%lf",&number);
printf("%.1f\n%.2f\n%.3f\n",number,number,number);
return 0;
}
Comments
Post a Comment
If you any doubt. Please let me know.