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

which feature are not hold visual basic of oop?

1816


Which type does string inherit from?

713


Why is abstraction used?

713


Give two or more real cenario of virtual function and vertual object

1953


What is stream in oop?

939






Will I be able to get a picture in D drive to the c++ program? If so, help me out?

1752


2. Give the different notations for the class.\

1670


what is graphics

2100


How do you explain polymorphism?

683


What is destructor give example?

694


Can main method override?

666


How oops is better than procedural?

675


What is methods in oop?

638


Which language is not a true object oriented programming language?

750


Can a varargs method be overloaded?

702