Would you like to add up all the even integers from zero to one thousand?

A good answer might be:

Probably not. Even with a hand calculator this would be tedious.

Adding Up Even and Odd Integers

There are simple formulas for the sum of even integers from 0 to N, for the sum of odd integers from 0 to N, and for the sum of all integers from 0 to N (look in your calculus book if you are interested.) But pretend that you don' know that. Let us write a program that calculates these three things. The user will enter the limit, N, and the program will count up from zero to N, adding each count to the appropriate sums.

Here is a skeleton for the program that does this:
import java.io.*;
// User picks ending value N
// programs sums odd integers,  even  integers, and all integers 0 to N
//
class addUpIntegers
{
  public static void main (String[] args ) throws IOException
  {
    BufferedReader userin = new BufferedReader (new InputStreamReader(System.in));
    String inputData;
    int N, sumAll = 0, sumEven = 0, sumOdd = 0;

    System.out.println( "Enter limit value:" );
    inputData = userin.readLine();
    N         = Integer.parseInt( inputData );

    int count = __________________
    while (  ________________ )    
    {
      (more statements will go here later.)

      __________________
    }

    System.out.print  ( "Sum of all : " + sumAll  );
    System.out.print  ( "\tSum of even: " + sumEven );
    System.out.println( "\tSum of odd : " + sumOdd  );
  }
}

QUESTION 2:

First, get the counting loop correct. Complete the three blanks (corresponding to the three aspects of a loop you must coordinate) so that the loop counts from zero to (and including) the limit.

Click Here after you have answered the question