This program is shared by Krunal Panchal, thanks for your contributions. Feel free to submit your program's to be posted on my c files.
This is a program for rounding up and down float values in c
For e.g if you have got float value of 8.5 then it is converted in to 9 and when you have got float value of 8.4 then it would be converted into 8.
Same way for any float value it could be converted to round up value into an integer.
Code:
#include<stdio.h>
#include<conio.h>
void main()
{
float n;
int i;
clrscr();
printf("\nEnter the Value\n\n");
scanf("%f",&n);
i=(n<0)?n-0.5:n+0.5;
printf("\nRound up value= %d",i);
getch();
}
0 comments:
Post a Comment