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

Which following examples represent a flat character
I need help with number twelve
A feature film runs 2 h 12 min. The theater requires 12 min between performances, and has 12 min of previews and short subjects to show before the feature. If t
Multiplying 2.1 and the number r results in 6.174. What is the value of r? Drag and drop the correct number into the box so that the equation is true.
Island colony founded ny sir walter raleigh that mysteriously disappeared in the 1850s
A general to particular paragraph is best written _____. as an opening paragraph in an essay as a transition paragraph in an essay as a major body paragraph in
Calloway department store buys jackets for $19.75 each and sells them for $37.88 each. what is the markup rate based on cost?
what is a locus of points
Which is the best example of the strength and advancement of the old kingdoms central government
How many grams of Fe2O3 are there in 0.500 mole of Fe2O3? 79.8 g ... In this reaction, what is the coefficient for calcium oxide? CaO + CO2