Summation of Odds and Evens | assignmentcollections.com
Repetition Structures : Summation of Odds and Evens
Design a Java program that calculates and then outputs the sum of all odd and then all even numbers between 0 and 100 separately. The program finally prints which of these summations is larger and also prints the difference between these two summations.
Tips : ( For Odd numbers generate and add : 1 + 3 + 5 + 7 + … + 97 + 99 and for Even numbers generate and add 2 + 4+ 6 + 8 + … 98 + 100 ).You may use the repetition method of your choice (for-loop, while, or do-while) to design your project.
The post Summation of Odds and Evens appeared first on My Assignment Geek.