Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the real time example of encapsulation?

1047


What is the main purpose of inheritance law?

1184


c++ program to swap the objects of two different classes

2395


How to use CMutex, CSemaphore in VC++ MFC

4769


What is a null tree?

1122


When not to use object oriented programming?

1077


What is the difference between static polymorphism and dynamic polymorphism?

1068


What are the 3 principles of oop?

1096


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(); }

2579


Why is object oriented programming so hard?

1065


What do you mean by abstraction?

1053


Is this job good for future? can do this job post grduate student?

2147


Why do while loop is used?

1014


Why do we need polymorphism in c#?

1143


what are the different types of qualifier in java?

2253