Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q2) - Prompt the user to enter a positive number of int elements, less than or equal to 50, or 0 to exit. If a

Q2) - Prompt the user to enter a positive number of int elements, less than or equal to 50, or 0 to exit. If a negative number or a number more than 50 is entered, prompt it is wrong and prompt for a positive number of elements less than or equal to 50; or 0 to exit.

If a valid (0< number <= 50) number of elements is entered, prompt the user to enter those many (as the number of elements already entered) integer elements (ignore cases to check that each value is integer - assume user enters integers). Accept the elements in an array.

Run the next steps with an array of size 10 - all indices are 0-based.

  1. - Print all the elements of the array
  2. - Print the starting address of the array and starting address of 0th element of array array_name[0]. Are they same ? ___________
  3. - Increment the 1st element - array_name[1].
  4. - Print the address of 2nd element - array_name[2]
  5. - Interchange the 3nd element - array_name[3] with the 4th element - array_name[4]. Use a separate function to do it.
  6. - Subtract the 6th element - array_name[6] from the 5th element - array_name[5] and store it in the 7th element - array_name[7] (overwrite the 7th - so earlier contents of 7th element will be lost). Use a separate function to do it. Choose what should be the arguments of the function to keep it generic.
  7. - Print the new array

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_2

Step: 3

blur-text-image_3

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

Ehs 2.0 Revolutionizing The Future Of Safety With Digital Technology

Authors: Tony Mudd

1st Edition

B0CN69B3HW, 979-8867463663

More Books

Students also viewed these Databases questions

Question

Analyse the various techniques of training and learning.

Answered: 1 week ago