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 |
Difference between vector and array
Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box
What are the 4 pillars of oop?
c++ program to swap the objects of two different classes
1. Wrie a function which returns the most frequent number in a list of integers. Handle the case of more than one number which meets this criterion. public static int[] GetFrequency(int[] list)
what is the need of abstraction? what is abstraction?what is the abstraction for stack?
What is difference between function overloading and overriding?
Why is polymorphism used?
what is inline function?
What is polymorphism give a real life example?
me get an assignent n its question is this 1.creat a set as in math i.ea={1,2} 2.insert element in it3. delete element don,t repeat any element 4.union 5. intersection of two sets plz help me i always pray for u n send me at ayeshawzd@hotmail.com f u have c++ how to program 5th addition then it is the 10.9 question in 10th chapter exercise
What is object and example?