Question: define an array called even to store the first 100 even integers (starting at 2) define and array called odd to store the first 100
define an array called even to store the first 100 even integers (starting at 2)
define and array called odd to store the first 100 odd integers (starting at 1)
hint: store the values in the array using a for loop
define a function called sum that:
returns an int that is the sum of the odd and even array values
print the total so that the output is:
even values: 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100
odd values: 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 The sum of odd and even values is: 5050
nOTE: IN C++ PLEAE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
