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
What is the real time example of encapsulation?
What is the main purpose of inheritance law?
c++ program to swap the objects of two different classes
How to use CMutex, CSemaphore in VC++ MFC
What is a null tree?
When not to use object oriented programming?
What is the difference between static polymorphism and dynamic polymorphism?
What are the 3 principles of oop?
What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }
Why is object oriented programming so hard?
What do you mean by abstraction?
Is this job good for future? can do this job post grduate student?
Why do while loop is used?
Why do we need polymorphism in c#?
what are the different types of qualifier in java?