(Print a table) Write a program that displays the following table:
a a^2 a^3
1 1 1
2 4 8
3 9 27
4 16 64
Answer
/**
Program - 04
Write a program that displays the following table:
a a^2 a^3
1 1 1
2 4 8
3 9 27
4 16 64
**/
public class HelloWorld
{
public static void main(String args[])
{
System.out.println("a a^2 a^3 ");
System.out.println("1 1 1 ");
System.out.println("2 4 8 ");
System.out.println("3 9 27 ");
System.out.println("4 16 64 ");
}
}
OUTPUT
a a^2 a^3
1 1 1
2 4 8
3 9 27
4 16 64
If you have any doubts or questions, please let me know.