is there any function in C to round up float value i.e we can write
4.236 as 4.24 or I have to write it?
Round up float value
Moderator: Board moderators
-
- Experienced poster
- Posts: 167
- Joined: Fri Oct 19, 2001 2:00 am
- Location: Saint Petersburg, Russia
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
Code: Select all
char str[100];
sprintf(str,"%.2f",a);
a=atof(str);
// be sure u're not using Turbo C++.The atof function in it has bugs.
// u can write a subroutine also that does the same thing life atof.
Life is like a box of Chocolates,
you never know what you're going to get...
you never know what you're going to get...