-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloop_II.java
37 lines (29 loc) · 872 Bytes
/
loop_II.java
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
37
import java.util.Scanner;
// Hacker rank problem : loop II problem
public class loop_II{
public static void series(int a , int b, int n) {
int s = a;
for(int i = 0; i<n ; i++){
s = s + ((int)Math.pow(2,i)) * b;
System.out.print(s + " ");
}
System.out.println("");
}
public static void main(String[] args){
try (Scanner sc = new Scanner(System.in)) {
int q = sc.nextInt();
nextLine();
int a,b,n;
while( q --> 0){
a = sc.nextInt();
b = sc.nextInt();
n = sc.nextInt();
nextLine();
series(a,b,n);
}
// series(a, b, n);
}
}
private static void nextLine() {
}
}