A good answer might be:

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

Adding Up Even and Odd Integers

There is a formula for the sum of even integers from 0 to N. There are formulas 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't know that. Let us write a program that calculates these three things. The user enters N, and the program counts up from zero to N, adding each number to the appropriate sum.

Here is a skeleton for the program:

import java.io.*;

// User enters a value N
// Add up 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. Fill in the three blanks (corresponding to the three aspects of a loop). The loop should count up from zero to (and including) the limit.