@@ -0,0 +1,1569 @@
+package thirty_days_of_code;%0D%0A%0D%0Aimport java.util.Scanner;%0D%0A%0D%0A/*%0D%0A * Problem Statement%0D%0A * %0D%0A * Welcome to Day 5!%0D%0A * %0D%0A * In this problem you will test your knowledge of loops. Given three integers%0D%0A * a, b, and N, output the following series:%0D%0A * %0D%0A * a+(2%5E0)b,a+(2%5E0b)+(2%5E1b),......,a+(2%5E0b)+(2%5E1b)+...+2%5E(N-1)b%0D%0A * %0D%0A * Input Format: %0D%0A * The first line will contain the number of testcases T. Each of the next T%0D%0A * lines will have three integers, a, b, and N.%0D%0A * %0D%0A * Constraints: %0D%0A * 0 %3C= T %3C= 500%0D%0A * 0 %3C= a,b %3C= 50%0D%0A * 1 %3C= N %3C= 15%0D%0A * %0D%0A * Output Format: %0D%0A * Print the answer to each test case in a separate line.%0D%0A * %0D%0A * Sample Input: %0D%0A * 2%0D%0A * 5 3 5%0D%0A * 0 2 10%0D%0A * %0D%0A * Sample Output: %0D%0A * 8 14 26 50 98%0D%0A * 2 6 14 30 62 126 254 510 1022 2046%0D%0A */%0D%0Apublic class Loops %7B%0D%0A%0D%0A    public static void main(String%5B%5D args) %7B%0D%0A        %0D%0A        Scanner sc = new Scanner(System.in);%0D%0A        %0D%0A        int numCases = sc.nextInt();%0D%0A        %0D%0A        for (int i = 0; i %3C numCases; i++) %7B%0D%0A            int a = sc.nextInt();%0D%0A            int b = sc.nextInt();%0D%0A            int N = sc.nextInt();%0D%0A            %0D%0A            int currentTerm = 0;%0D%0A            int previous = a;%0D%0A            int currentLine = 0;%0D%0A            %0D%0A            for (int j = 0; j %3C N; j++) %7B%0D%0A                currentTerm = ((int) Math.pow(2, j)) * b;%0D%0A                currentLine = currentTerm + previous;%0D%0A                previous = currentLine;%0D%0A                System.out.print(currentLine + %22 %22);%0D%0A            %7D%0D%0A            System.out.println();%0D%0A        %7D%0D%0A        sc.close();%0D%0A    %7D%0D%0A%7D

Add Loops