Round up a Decimal number in c++..

example Note = 3.5 is as 4
3.3 is as 3

Answer Posted / vivek

#include <iostream>
#include <string>
using namespace std;


int main(void)
{
float a,b,c;
int k;
cout << "enter 1st number ";
cin>>a;
cout<<"enter 2nd number ";
cin>>b;
c=a/b;
cout<<"original value "<<c;
if (c=c+0.5)
{
k=c;
cout<<"\n"<<"round figure "<<k;
}
else
return 0;
}

Hope this code helped u smways

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the advantage of oop over procedural language?

724


What is object in oop?

782


What is overloading in oops?

703


What is byval and byref? What are differences between them?

1792


Can private class be inherited?

716






Which type does string inherit from?

713


What is object-oriented programming? Webopedia definition

835


why reinterpret cast is considered dangerous?

1995


How does polymorphism work?

737


What does and I oop mean in text?

731


What is object in oop with example?

820


program for insertion ,deletion,sorting in double link list

2358


What is polymorphism and types?

680


What is polymorphism explain?

801


write a program to find 2^n+1 ?

1654