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

Without using a protractor to measure exactly, choose the BEST possible measurement of the angle above. A. 90° B. 45° C. 85° D. 160°
Consider the equation y = -2x + 5. Create a table of five ordered pairs that satisfy the equation. What is the y-intercept of the equation? What is the x-interc
NEED HELP ANSWERING THIS QUESTION
Sydney needs 70cm of feinge for each scarf she makes. How many scarves can she make if she has 6 meters of fringe?
Which expression is represented by the model? A. X-3 B. X+3 C. -X-3 D.-X+3
-0.18x + y = -6.54 -2.8x - y = -2.4
What happens to pressure as temperature increases and temperature decreases
If you were to choose one, which of Earth's spheres is the most important, and why?
does anyone know python 3? my code isnt working and i dont know anyone who can help me​
by which reason can it be proven that triangles DAB and DAC are congruent