[SOLVED] Write a program that reads 15 numbers (integers)

20.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (1 vote)

Write a program that reads 15 numbers (integers) from stdin, then displays the following:
The total of the even numbered values (2nd value+ 4th value+ etc..)
The total of the odd numbers (1st value + 3rd value + etc…)
The total of every 5th number.
Note that “even numbered values” mean the 2nd value, 4th value, etc., not “2”, “4”, “6”, etc.
For example:
The data is:
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
The even values are:
1+3+5+7+9+11+13 = 49
The odd values are:
0+2+4+6+8+10+12+14 = 56
Every fifth values are:
4+9+14 = 27
Another example:
The data is:
7,3,9,11,25,47,98,45,76,21,99,35,67,83,12
The even values are:
3+11+47+45+21+35+83 = 245
The odd values are:
7+9+25+98+76+99+67+12 = 393
Every fifth values are: 25+21+12 = 58

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.