forked from jsquared21/Intro-to-Java-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise_02_18.java
More file actions
executable file
·36 lines (36 loc) · 863 Bytes
/
Exercise_02_18.java
File metadata and controls
executable file
·36 lines (36 loc) · 863 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
/*
(Print a table) Write a program that displays the following table. Cast floatingpoint
numbers into integers.
a b pow(a, b)
1 2 1
2 3 8
3 4 81
4 5 1024
5 6 15625
*/
public class Exercise_02_18 {
public static void main(String[] args) {
float a, b;
System.out.println("a b pow(a, b)");
a = 1;
b = 2;
System.out.println((int)a + " " + (int)b +
" " + (int)Math.pow(a, b));
a++;
b++;
System.out.println((int)a + " " + (int)b +
" " + (int)Math.pow(a, b));
a++;
b++;
System.out.println((int)a + " " + (int)b +
" " + (int)Math.pow(a, b));
a++;
b++;
System.out.println((int)a + " " + (int)b +
" " + (int)Math.pow(a, b));
a++;
b++;
System.out.println((int)a + " " + (int)b +
" " + (int)Math.pow(a, b));
}
}