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

35 girls and boys went walking. The ratio is 5 girls to every 2 boys. How many boys are there?
in which of the following sentences is the underlined word a concrete noun? A. Running is her favorite pastime B. He was helping the boys to finish their chore
How were law and order maintained in medieval Europe?
What is the value of 134 + 2n2 when n = 6? (Points : 1) 68 98 170 206
a field hockey ball is launched from the ground at an angle to the horizontal. what are the ball's horizontal and vertical accelerations at its maximum height?
socrates was sentenced to death by jury of athenian citizens mainly because why?
Convert the following numbers into Scientific Notation 1) 3.400 2) 0.000023 3) 101,000 4) 0.010 5) 45.01 6) 1,000,000 7) 0.00671 8) 4.50
Why did railroads have a greater impact on American society than did canals and steamboats?
The process of exchanging oxygen and carbon dioxide between blood, air and tissues what is it called.
A regular pentagon is inscribed in a circle whose radius measures 9 inches. Find the area of the pentagon.