We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Here are the Easiest way Without Using any in-build function
import java.util.Scanner;
class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int time = sc.nextInt();
int e = 1;
for (int i = 0; i < time; i++) {
int a = sc.nextInt(), b = sc.nextInt(), n = sc.nextInt();
for (int j = 0; j < n; j++) {
a = a + b * e;
e *= 2;
System.out.print(a + " ");
}
e = 1;
System.out.println();
}
sc.close();
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Loops II
You are viewing a single comment's thread. Return to all comments →
Here are the Easiest way Without Using any in-build function
import java.util.Scanner;
class Solution {
}