So I'm trying to write an application that will allow a user to enter a series of integers such as : 45, 4, 5, 12, 10.
The application will need to find the sum of only the odd numbers then find the sum of only the even numbers. I have tried this in so many ways for the past few days my head hurts.
I figure out how to tell if a number is odd or even by using the mod statement; If myNum Mod 2 = 1 then return odd else even.
However to go through the series of numbers, grab only the odd ones for examples then add them all together has me stuck.
The application will need to find the sum of only the odd numbers then find the sum of only the even numbers. I have tried this in so many ways for the past few days my head hurts.
I figure out how to tell if a number is odd or even by using the mod statement; If myNum Mod 2 = 1 then return odd else even.
However to go through the series of numbers, grab only the odd ones for examples then add them all together has me stuck.