1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
LekaFEV [45]
3 years ago
13

C++ program: Write a program that prompts the user to input three numbers. The program should then output the numbers in ascendi

ng order, separated by a single space.
Computers and Technology
1 answer:
Lelechka [254]3 years ago
3 0

Answer:

// here is code in C++.

#include<iostream>

using namespace std;

int main()

{

// declare variables

  double num1, num2, mun3, t;

  cout << "Enter three numbers: ";

// read the three numbers

  cin >> num1 >> num2 >> mun3;

  //sort the three numbers

  if( num1>num2 )

  {

     t = num1;

     num1 = num2;

     num2 = t;}

  if( num2>mun3 ){

     t = num2;

     num2 = mun3;

     mun3 = t;}

  if( num1>num2 ){

     t = num1;

     num1 = num2;

     num2 = t;

  }

  // print the output

  cout<<"numbers in ascending order:";

  cout << num1 << " " << num2 << " " << mun3 << endl;

  return 0 ;

}

Explanation:

Declare three variables to store the input. Read the value of all three variables. If first number is greater than second, then with the help of variable "t" swap the  value of first and second.after that if second is greater than third number, swap them.In last if first number is greater than second one then swap them. This will sort the three numbers in ascending order.

Output:

Enter three numbers: 3 7 2                                                                                                

numbers in ascending order:2 3 7

You might be interested in
Can someone please answer these questions! Thank you :)
kolbaska11 [484]
1. Technology is something that makes things easier. 2. Technology help students in someway maybe find information about something the good thing about technology in students is that they can learn more things and the bad thing is that technology can be dangerous for students,
3 0
3 years ago
Explain the process of a for loop and how it is used in code
marshall27 [118]

Ex:

FOR Count= 1 TO 50

.......................

Body

......................

NEXT

Next keeps incrementing count by 1

Hope it helps

4 0
3 years ago
Of the two basic methods of data entry, keyboards use keystrokes to enter data and instructions; what is the nonkeyboard method
Sergio [31]
The correct answer of the given question above would be second option: SOURCE DATA ENTRY. <span>Of the two basic methods of data entry, keyboards use keystrokes to enter data and instructions; the non keyboard method is called the source data entry.</span>
4 0
4 years ago
Why would a virtual machine be useful in a school? It provides a completely secure connection to the internet. Students can coll
Stels [109]
They can learn more and also it’s faster
5 0
3 years ago
paula needs to ensure that an animation she has created is repeated. which option should she use to achieve this ?
Masteriza [31]

Answer:

transitions tab

Explanation:

please mark brainliest

4 0
3 years ago
Other questions:
  • How to screen shot on a computer
    14·2 answers
  • How can my computer catch a virus?
    13·1 answer
  • The index number of a combobox object can be assigned to a(n) ____ data type variable
    13·1 answer
  • How are computers used in producing weather forecasts?
    8·1 answer
  • Who initially developed what is now known as the internet?
    5·1 answer
  • Dany needs to fact check notes she took on 19th
    13·1 answer
  • 1. We want to add a button to the tally counter in Section 9.2 that allows an operator to undo an accidental button click. Provi
    8·1 answer
  • Assume that processor refers to an object that provides a void method named process that takes no arguments. As it happens, the
    5·1 answer
  • Which of the following devices can be connected to a network? Check all of the boxes that apply.
    9·1 answer
  • A.m. client appears at the top of every page
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!