Write a program that displays the following table:

LANGUAGE: Java

CHALLENGE:

Write a program that displays the following table:

  a     a^2     a^3
  1     1       1
  2     2       8
  3     9       27
  4     16      64

SOLUTION:

public static void main(String[] args){
    System.out.println(" a a^2 a^3");
    System.out.println(" 1 1 1");
    System.out.println(" 2 2 8");
    System.out.println(" 3 9 27");
    System.out.println(" 4 16 64");
}