Question

In: Computer Science

Design the logic for a program that has two parts: The user enters 15 numbers that...

Design the logic for a program that has two parts:

  1. The user enters 15 numbers that are stored into an array.
  2. The program uses the array to display the numbers back to the user in reverse order.

You must use an array and one or more loops to get full credit.

Can someone please help me figure this out?

Solutions

Expert Solution

Hello student. I am using c++ for coding.If you need any other language,

Please comment.Looking forward to help you

code

--------

#include <iostream>

using namespace std;

int main() {
//declaring an array to store 15 numbers
int arr[15];
cout<<"Enter the numbers to be stored in the array : ";
// for loop to read the array values
for(int i=0;i<15;i++)
{
cin>>arr[i];
}
//Print the numbers in the reverse order.

cout<<"\n The numbers in the reverse order :";
for(int i=14;i>=0;i--)
{
cout<<arr[i]<<" ";
}
  
return 0;
}


Related Solutions

Design the logic for a program that has two parts. The user enters 15 test scores...
Design the logic for a program that has two parts. The user enters 15 test scores (values between 1-100) that are stored in an array. The program uses the array to compute and output the following statistics minimum maximum average Write this in pseudocode.
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
Write a C++ program that reads numbers from the user until the user enters a Sentinel....
Write a C++ program that reads numbers from the user until the user enters a Sentinel. Use a Sentinel of -999. Ignore all negative numbers from the user input. Do the following: Output the sum of all even numbers Output the sum of all odd numbers Output the count of all even numbers Output the count of all odd numbers You must use loops and numbers to do this. You must not use any arrays or vectors for this program.
(JAVA) Implementing a Program Design a program that prompts the user for twenty numbers. If the...
(JAVA) Implementing a Program Design a program that prompts the user for twenty numbers. If the number is positive, then add the number to the current sum. If the number is negative, then subtract the sum by one. Implement just the main method. Assume that all libraries are imported, and class has been declared.
Design a modular program which asks the user to enter a list of numbers. The numbers...
Design a modular program which asks the user to enter a list of numbers. The numbers must be stored in an array. The program then finds the index of the first occurrence of the smallest element in the array and the last occurrence of the largest element in the array. The program displays the position and value of each of these items.
Using Java, design a program to let user enter two lists of numbers within the range...
Using Java, design a program to let user enter two lists of numbers within the range [0, 9] from keyboard, you could either use flag to denote end of the list or ask user to enter the list size first and then enter the list numbers. Each of these two lists represents a set (keep in mind that duplicate elements are not allowed in the same set but are allowed between sets), so we have two sets A and B....
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic:...
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic: Ask for a number, add that number to the front of the list, print the list. Repeat until they enter -1 for the number. . Sample Input: 10, 15, 5, 2, 4, -1 Output: 4, 2, 5, 15, 10. Next sort all the numbers using selection sort and display them. Next give the user option to search for a specific number in the list....
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic:...
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic: Ask for a number, add that number to the front of the list, print the list. Repeat until they enter -1 for the number. . Sample Input: 10, 15, 5, 2, 4, -1 Output: 4, 2, 5, 15, 10. Next sort all the numbers using selection sort and display them. Next give the user option to search for a specific number in the list....
C++ Program: Write a program that prompts the user for two numbers and stores them in...
C++ Program: Write a program that prompts the user for two numbers and stores them in signed integers. The program should then add those two numbers together and store the result in a signed integer and display the result. Your program should then multiply them by each other and store the result in another integer and display the result. Then do the same but with dividing the first number by the second. Display an error message to the screen if...
Write a MIPS program that will ask the user to enter two numbers at the console...
Write a MIPS program that will ask the user to enter two numbers at the console and pass the values to a function that does multiplication
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT