Round up a Decimal number in c++..

example Note = 3.5 is as 4
3.3 is as 3

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is inheritance in oop?

604


What is pointer in oop?

535


What is polymorphism and example?

592


What is polymorphism in oops?

558


How oops is better than procedural?

587






How do you use inheritance in unity?

590


What is inheritance in simple words?

625


What is oops with example?

564


Can bst contain duplicates?

668


What is overloading in oops?

598


What is object in oops?

614


IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?

1581


What does and I oop mean?

614


Why do we use class in oops?

555


What is oops and why we use oops?

573