Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in C++ to read n integers into an array and display it in reverse order. Ask the user for the integers of

Write a program in C++ to read n integers into an array and display it in reverse order.

  • Ask the user for the integers of values to read - (this value will be less than 25)
    • Input the number of integers to store in the array: 3
    • echo print the input
  • Read the elements into the array using format - (you should echo print the input)
 Input 3 integers: integer - 0 : 2 integer - 1 : 5 integer - 2 : 7 
  • Expected Output :
 The values stored into the array are : 2 5 7 The values stored into the array in reverse are : 7 5 2 
  • Also report:
    • The sum of all elements of the array
    • The total number of duplicate elements in the array.
    • The maximum and minimum element in the array

[edit]Sample Run

Input the number of elements to store in the array: 10 Input 10 integers: integer - 0 : 1 integer - 1 : 2 integer - 2 : 3 integer - 3 : 4 integer - 4 : 3 integer - 5 : 2 integer - 6 : 1 integer - 7 : 9 integer - 8 : 8 integer - 9 : 7 The values stored into the array are : 1 2 3 4 3 2 1 9 8 7 The values stored into the array in reverse are : 7 8 9 1 2 3 4 3 2 1 The sum of all elements of the array is 40 The total number of duplicate elements in the array is 3 The maximum and minimum element in the array are 1 , 9 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions