Question: In the Main, make an array with a size equal to (5 x the number of letters in your name), beginning at 0 and increasing

In the Main, make an array with a size equal to (5 x the number of letters in your name), beginning at 0 and increasing by 1 with each spot . Create a bool function called ImOdd. In the function, add the numbers, beginning with 0, that occur in intervals increasing by 1 in the following manner:

Number of spots to move = number of spots to move +1

Array position = array position + number of spots to move

Sample array: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Logic:

0 moving to 1 = number of spots to move = 1

1 moving to 3 = number of spots to move = 2

3 moving to 6 = number of spots to move = 3

6 moving to 10 = number of spots to move = 4

10 moving to 15 = number of spots to move = 5

Sample answer: 35

Sum only the numbers that occur on this interval and keep going until you run out of numbers in your array. Check to see if the sum is odd or even. If odd, return ImOdd as true. If even, return ImOdd as false. In the main, output the result of the function (please note if it is true, the output will be 1 and if it is false, the output will be 0).

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!