C program to print a fractional number after rounding it to two decimal places

Program code

#include <stdio.h>

#include <conio.h>

void main()

{

float a;

clrscr();

printf("Please insert a number.\n");

scanf("%f",&a);

printf("The number you have entered is %.2f",a);

getch();

}


Example of output

Please insert a number.

7.7777

The number you have entered is 7.78 

Share:

No comments:

Post a Comment

Popular Posts

Contact Form

Name

Email *

Message *

Recent Posts

Copyright Matlab Project Codes All rights Reserved. Powered by Blogger.

Blog Archive