Round up a Decimal number in c++..
example Note = 3.5 is as 4
3.3 is as 3
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / vimala
void main()
{
float a,c;int b,d;
cout<<"ENTER ANY FLOAT VALUE:";
cin>>a;
b=a;c=(a-b);
if(c>=.5)
d=b+1;
else
d=b;
cout<<"AFTER ROUND UP THE DECIMAL NO IS:"<<d;
getch()
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / pawarp
#include <iostream>
#include <cmath>
int main()
{
float a;
cout<<"Enter any float value to round up"<<endl;
cin>>a;
cout << round(a)<<endl;
return 0;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
1. Strong name 2. how to prevent a class from being inherited 3. delegates 4. default modifier for interface 5. default modifier for class 6. base class for exception 7. diff bet trigger and view in sql 8. how to exchange values from one page to another page 9. can multiple catch block ll be executed at same time 10. can u store different data types in an array & array list 11. when we ll use trigger 12. try,catch,finally usage
What is polymorphism what are the different types of polymorphism?
What is late bound function call and early bound function call? Differentiate.
write a C++ program for booking using constructor and destructor.
what is pointers
Can we create object of class with private constructor?
What is object-oriented programming? Webopedia definition
What are main features of oop?
#include <iostream> using namespace std; int main() { int a = 3; int c[5][5]; for (int x=0;x<5;x++) { for (int y=0;y<5;y++) { c[x][y] = x*y; } } cout << c[a][2]; }
write a program to find 2 power of a 5digit number with out using big int and exponent ?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
What does the code "cout<<(0==0);" print? 1) 0 2) 1 3) Compiler error: Lvalue required