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

7. If U = {2, 4, 6, 8, 10, 12, 14, 16} and A = {6, 10, 14}, what is A'?​
relieves nasal or chest congestion
200 word speech about social media destroyes a person s self esteem
There are 6 glasses in a box. 1 is broken. How many glasses are not broken? How would you work this out?
please help me find the price of bottles what is the slope of the líne as a fraction & decimal in simplest form please
pros and cons of investing in smart monitoring systems and automation technologies to maintain the integrity of perishable goods during power cuts. Evaluate how
How do i work out these vectors on the lines
print('The {2} {1} {0}'.format('fox', 'brown', 'quick'))
Given the following data, find the diameter that represents the 82nd percentile Diameters of Golf Balls 1.33 1.601.62 1.56 1.49 1.46 1.451.47 1.64 1.49 1.701.51
Humans possess two alleles, or variations, for each gene. The alleles may be the same, or they may be different. When humans reproduce, their alleles are separ