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

Help Find X and y. Thank you.
Plss help! I'm offering 20 points
9.225 times 10 to the 8th power
Write a poem about anything
Sociologists talk about differences between norms and values. What is the difference between the two? Explain and then give 3 examples to support your answer.
A plane travels at a rate of 14,200 miles every 2 hours. How far can this plane travel in 4.5 hours? 35,500 miles 63,900 miles 28,450 miles 31,950 miles
let the marked price be Rs x, s.p is rs 180 and discont percent is 10 percent . find the marked price
2. Usa el mandato afirmativo con tú. i_______ el antibiotico! (Tomar)
. Use the equation for Charles’s Law to explain what happens to the temperature inside of a compressed gas canister if you squeeze and reduce the volume inside
Help me, please. I will be giving brainlyist to the first person to answer