jonnika27 jonnika27
  • 23-02-2020
  • Computers and Technology
contestada

Write a program that prompts the user to input the decimal value of a double and outputs the number rounded to the nearest integer.

Respuesta :

beingteenowfmao
beingteenowfmao beingteenowfmao
  • 24-02-2020

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

double n;

cout<<"Enter a decimal number: ";

cin>>n;

int Round= floor((n- floor(n))*2);

if(Round==0)

{

n= floor(n);

}

else n= ceil(n);

cout<<n;

return 0;

}

Ver imagen beingteenowfmao
Answer Link

Otras preguntas

c+2c+12=75 what is the value of c?
When Ivan IV took power, he named his vast territory USSR. Mongolia. Kiev Rus. Russia.
Which of the following is true about foreign and domestic affairs? They are completely separate types of policy issues that do not affect one another. Leaders
which religious sect formed the first abolitionist group in the U.S ?
Give an example of where you use pressure in your daily life?
A cube and the net for the cube are shown. What is the surface area of this cube?A.30 cm²  B.70 cm²  C.125 cm²  D.150 cm²
Solve the following proportion for u. 5/13 = u/11 Round your answer to the nearest tenth.
there are 950 seats in a theater . 82% of the seats are occupied. How many seats are not occupied
Which of newtons laws helps explain the orbit of a space shuttle around Earth and the orbit of Earth and the sun? please answer asap! :)
what were the most difficult challenges faced by the plymouth and Jamestown settlers?