Question: Problem #2: 120 pts) Write a program that prompts the user to enter the size 'n' (ONLY positive) of an array 'a' and its integer

 Problem #2: 120 pts) Write a program that prompts the user

Problem #2: 120 pts) Write a program that prompts the user to enter the size 'n' (ONLY positive) of an array 'a' and its integer elements. The program should calculate and output the sum of ODD elements in EVEN positions (if any). For example, given the below array, 0 4 2 8 5 7 The sum is af0+a[ 41=3+7=10. The element a[2] is not added to the sum because the value is even Sample run 1 Enter the array size (only positive) : -5 No array Sample run 2 Enter the array size (only positive): 7 Enter a[01-7 Enter a 1) - 2 Enter a [2]- 5 Enter a [3]- 14 Enter a [4]- 13 Enter a [5) - 11 Enter a[6] - 18 The sum is 25 //hint the sum 13 a[0] +a[21ta141=7+5+13-25

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!