I'm currently on some basic exercises on HackerRank (It's my 3rd day with Java). I just finished writing the code:
import java.io.*;
import java.util.*;
import java.lang.Math;
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int seriesInput = scanner.nextInt();
for (int q = 0; q < seriesInput; q++) {
int inputA = scanner.nextInt();
int inputB = scanner.nextInt();
int inputN = scanner.nextInt();
double s0 = inputA + Math.pow(2, 0) * inputB;
int s2 = (int) s0;
System.out.print(s2 + " ");
for (int i = 1; i < inputN; i++) {
s0 += Math.pow(2, i) * inputB;
int s1 = (int) s0;
System.out.print(s1 + " ");
} System.out.println();
} scanner.close();
}
}
This is my full answer to the Java Loops II question on HackerRank. Thank you for all the help!