-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquaresAndCubes.java
More file actions
36 lines (18 loc) · 821 Bytes
/
SquaresAndCubes.java
File metadata and controls
36 lines (18 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.Scanner;
public class SquaresAndCubes{
public static void main(String[] args){
Scanner userInput = new Scanner(System.in);
System.out.println("number\tsquare\tcube");
System.out.printf("0\t %d \t%d%n", 0 * 0, 0 * 0 * 0);
System.out.printf("1\t %d \t%d%n", 1 * 1, 1 * 1 * 1);
System.out.printf("2\t %d \t%d%n", 2 * 2, 2 * 2 * 2);
System.out.printf("3\t %d \t%d%n", 3 * 3, 3 * 3 * 3);
System.out.printf("4\t %d \t%d%n", 4 * 4, 4 * 4 * 4);
System.out.printf("5\t %d \t%d%n", 5 * 5, 5 * 5 * 5);
System.out.printf("6\t %d \t%d%n", 6 * 6, 6 * 6 * 6);
System.out.printf("7\t %d \t%d%n", 7 * 7, 7 * 7 * 7);
System.out.printf("8\t %d \t%d%n", 8 * 8, 8 * 8 * 8);
System.out.printf("9\t %d \t%d%n", 9 * 9, 9 * 9 * 9);
System.out.printf("10\t %d \t%d%n", 10 * 10, 10 * 10 * 10);
}
}