You are viewing a single comment's thread. Return to all comments →
import java.util.Scanner; class Solution { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int q = sc.nextInt(); for(int i=0; i<q; i++) { int a, b, n; a = sc.nextInt(); b = sc.nextInt(); n = sc.nextInt(); int series = a; for(int j=0; j<n; j++) { series += Math.pow(2, j) * b; System.out.print((int)series + " "); } System.out.print("\n"); } sc.close(); } }
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 →
For Java15 Platform
I wrote the code from scratch just to get more practice