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
Can a destructor be called directly?
What are the benefits of interface?
What is destructor example?
What is polymorphism in oop example?
What is the advantage of oop over procedural language?
write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).
design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)
What is a function in oop?
What is debug class?what is trace class? What differences are between them? With examples.
Why is polymorphism used?
What is difference between data abstraction and encapsulation?
Why do while loop is used?
What is this pointer in oop?
What are the benefits of oop?
What is oops and its features?