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

what is 64% of 40 104 28.3 26 25.6
Building blocks of proteins are
After all of the account balances have been extended to the balance sheet columns of the end-of-period spreadsheet, the totals of the debit and credit columns a
In which situation would it be least likely for a scientist to revise her experimental methods
How did the rise of fascism in Italy and Germany impact women living in those countries? A. Women became restricted by rigid, traditional gender roles.
Plants on the floor of a rain forest often have very dark green leaves. this coloration is due to the presence of____ amounts of chlorophyll in the leaves, whic
Describe the US foreign policy during the the 1950's.
PLEASSSE HELP ASAP The legs of a right triangle are 3 units and 7 units. What is the length of the hypotenuse? Round your answer to the nearest hundredth. 4.00
What is the measure of one exterior angle of a regular hexagon? 60 72 90
REWRITE THIS SENTENCE DNA was already thought to be important in the transference of hereditary information from cell to cell, but Watson and Crick’s structu