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

why do some cells divide faster than others
Which equations could model this problem? Four friends purchased tickets to a play. The total cost for all four tickets was $186. What was the unit price, t,
Alliteration in the hobbit
what is the theme of romeo and juliet
What number is 70% of 130?
A piece of pipe is 303/4 inches long. If five pieces, each 41/3 inches long, are cut from the pipe, how many inches of pipe remain? A. 9 3/4 inches B. 26 3/4 in
Shakespeare's Macbeth is considered a masterpiece of the _____ genre. A. horror B. tragedy C. history D. comedy
An electric current produces a magnetic field. Please select the best answer from the choices provided T F
Susan will be working as a camp counselor this summer. What is the verb tense and aspect?
Doubles minus one to solve 8+7