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 animals are selected for use in pastoral nomadism? why are they selected?
Into which group would you place a unicellular organism that has 70s ribosomes and a peptidoglycan cell wall
Wilson (1985) found that the more people consider the reasons why they like something,
The rate constant is found to be 3.9 x 10-5 M-1 s-1. Calculate the rate of formation of ozone when the concentration of oxygen atoms is 3.0 x 10-14 molar and th
How many ways are there to distribute five balls into seven boxes if?
List at least five challenges to maintaining global competitiveness.
Why do you think water is often called the universal solvent?
The mcdougals use harsh discipline on their children and demand unquestioning obedience. psychologists are likely to characterize the mcdougals as ________ pare
what is the number of electrons shared between the atoms in I2 molecule (That is an i not a 1) 1) 7 2) 2 3) 8 4) 4
What is one way that members of Archaebacteria are different from members of Eubacteria? They lack nuclei in their cells. They have many cells that do d