- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathJavaLoopsII.java
More file actions
Latest commit
20 lines (17 loc) · 575 Bytes
/
Copy pathJavaLoopsII.java
File metadata and controls
20 lines (17 loc) · 575 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
importjava.util.Scanner;
publicclassJavaLoopsII {
publicstaticvoidmain(String[] args) {
Scannerscanner = newScanner(System.in);
intqueries = scanner.nextInt();
while (queries-- > 0) {
inta = scanner.nextInt();
intb = scanner.nextInt();
intn = scanner.nextInt();
for (intindex = 1, sum = a + b ; index <= n ; index++) {
System.out.print(sum + " ");
sum += (int) Math.pow(2, index) * b;
}
System.out.println();
}
}
}