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

The 3 items are on sale for $15, $16.95, and $20How to correct this sentence by editing the numbers for the correct form, figures or words
A MILKMAN SOLD TWO OF HIS BUFFALOES FOR RS.20,000. EACH ON ONE HE MADE A GAIN OF 5% AND ON THE OTHER A LOSS OF 10%. FIND HIS OVERALL GAIN OR LOSS.
Good thesis statement on how Androids better than iPhones?
a bank allows university students a 1000 overdraft facility on their bank accounts. in one month a student was 675 overdrawn. the next month the same student
how did greece's geography discourage unity among the people
what is 3x+4y=2 in slope intersect form
what is 3x+4y=2 in slope intersect form
Which group of intellectual women established literary clubs of their own around 1750 under the leadership of Elizabeth Vesey and Elizabeth Montagu? a) the Behn
what is the 23rd term from these sequences   5,6,7,8,9
Our galaxy contains roughly 250000000000 stars. How many billion is this?