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 |
what is SPL in c++.
write a function that takes an integer array as an input and finds the largest number in the array. You can not sort array or use any API or searching needs?
2 Answers IBMS, Zycus Infotech,
What is the benefit of oop?
What is the main difference between C++ and Java
can you give the dynamic polymorphism types?
why constructor cannt be declar virtually? why destructor cannt be overloaded?
• What are the desirable attributes for memory managment?
any one please tell me the purpose of operator overloading
what is polymorpsim? what are its types?
what is function over loading?
What are the advantanges of modularity
Round up a Decimal number in c++.. example Note = 3.5 is as 4 3.3 is as 3
3 Answers Accenture, Cognizant, IBM,