Question

In: Computer Science

Lab 1 – Numbers in Descending Order Design an application that accepts 10 numbers and displays...

Lab 1 – Numbers in Descending Order

Design an application that accepts 10 numbers and displays them in descending order

For the programming problem, create the pseudocode and enter it below.

Enter pseudocode here

Solutions

Expert Solution

Solution :

Pseudocode is here

// Start

//     Declarations

//         num SIZE = 10

//         num NUMBERS[10]

//         num i

//         num j

//         num temp

//     for i = 0 to SIZE - 1

//         output "Please enter a number: "

//         input NUMBERS[i]

//     endfor

//     for i = 0 to SIZE - 2

//         for j = 0 to SIZE - 2

//             if (NUMBERS[j] < NUMBERS[j+1])

//               temp = NUMBERS[j]

//               NUMBERS[j] = NUMBERS[j+1]             

//               NUMBERS[j+1] = temp

//             endif

//         endfor

//     endfor

//     output "Sorted List"

//     output "==========="

//     for i = 0 to SIZE - 1

//         output "Number ", i + 1, ": ", NUMBERS[i]

//     endfor

// Stop

Code for above pseudocode:

#include<iostream>
using namespace std;
int main()
{
int NUMBERS[10],SIZE=10,i,j,temp;
for(i=0;i<SIZE;i++)
{
cout<<"Please enter number : ";
cin>>NUMBERS[i];
}
for(i=0;i<SIZE-1;i++)
{
for(j=0;j<SIZE-1;j++)
{
if(NUMBERS[j]<NUMBERS[j+1])
{
temp=NUMBERS[j];
NUMBERS[j]=NUMBERS[j+1];
NUMBERS[j+1]=temp;
}
}
}
cout<<"Sorted List"<<endl;
cout<<"===================="<<endl;
for(i=0;i<SIZE;i++)
{
cout<<"Number "<<i+1 <<" : "<<NUMBERS[i]<<endl;
}
return 0;
}

INPUT:

Please enter number : 2
Please enter number : 3
Please enter number : 4
Please enter number : 8
Please enter number : 1
Please enter number : 10
Please enter number : 7
Please enter number : 6
Please enter number : 5
Please enter number : 9

OUTPUT :

Sorted List
====================
Number 1 : 10
Number 2 : 9
Number 3 : 8
Number 4 : 7
Number 5 : 6
Number 6 : 5
Number 7 : 4
Number 8 : 3
Number 9 : 2
Number 10 : 1

Thank you sir..!


Related Solutions

(Use the GenericStack class) Write a program that displays the first 100 prime numbers in descending...
(Use the GenericStack class) Write a program that displays the first 100 prime numbers in descending order. Use a stack to store the prime numbers.
Draw a flowchart and pseudocode that accepts three numbers from a user and displays a message...
Draw a flowchart and pseudocode that accepts three numbers from a user and displays a message if the sum of any two numbers equals the third. Make a working version of this program in Python.
In C# Create a windows application which accepts the month number and displays the month name...
In C# Create a windows application which accepts the month number and displays the month name in a label.   Use a nested if... else statement to determine the month name. For months not in the range 1-12 display the message "Not a valid month"
Write and test a Python program to print a set of real numbers in descending order....
Write and test a Python program to print a set of real numbers in descending order. The program should also print out the median of the numbers input and how many numbers were input. The program should read in numbers until a negative number is read. The negative number serves as a sentinel or marker telling the program when to stop reading numbers. The program should then sort the numbers and print them out in order from largest to smallest....
Write an application named OddNums that displays all the odd numbers from 1 through 99. All...
Write an application named OddNums that displays all the odd numbers from 1 through 99. All ODD numbers should show all together(Should not need to scroll down), do it in 10 rows. FOR C#
Design the logic for a program that allows a user to enter 20 numbers, then displays...
Design the logic for a program that allows a user to enter 20 numbers, then displays them in the reverse order of entry. Design the logic for a program that allows a user to enter 20 numbers, then displays each number and its difference from the numeric average of the numbers entered. The program is C++. I need a Pseudocode
9.7 LAB: Inserting an integer in descending order (doubly-linked list) Given main() and an IntNode class,...
9.7 LAB: Inserting an integer in descending order (doubly-linked list) Given main() and an IntNode class, complete the IntList class (a linked list of IntNodes) by writing the insertInDescendingOrder() method to insert new IntNodes into the IntList in descending order. Ex. If the input is: 3 4 2 5 1 6 7 9 8 -1 the output is: 9 8 7 6 5 4 3 2 1 Sortedlist.java import java.util.Scanner; public class SortedList { public static void main (String[] args)...
This lab is designed to design an event driven animation application which JavaFX application implementing a...
This lab is designed to design an event driven animation application which JavaFX application implementing a racing car image. The car moves from left to right. When it hits the right end, it restarts from the left and continues the same process. Let the user pause/resume the animation with a button press/release and increase/decrease the car speed by pressing the up and down arrow keys. The car used for this application has the following attributes. Task(s) Task 1: Create a...
Design a 4 bit Counter that displays even numbers when a switch on, and odd when...
Design a 4 bit Counter that displays even numbers when a switch on, and odd when the switch off . 1.by using multisim (explain in details and information of how you do it in multisim) show steps of multisim and which gates numbers you used.
Design a 4 bit Counter that displays even numbers when a switch on, and odd when...
Design a 4 bit Counter that displays even numbers when a switch on, and odd when the switch off by D flip-flop by training borad
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT