Java Loops II

  • + 0 comments
    import java.util.Scanner;
    import java.lang.*;
    
    class Solution
    {
        public static void main(String args[])
        {
            Scanner sc = new Scanner(System.in);
            int j,i,q;
            q = sc.nextInt();
            
            for(i=0;i<q;i++)
            {
                int a = sc.nextInt();
                int b = sc.nextInt();
                int n = sc.nextInt();
                
                for(j=0;j<n;j++)
                {
                    a = a + (int)Math.pow(2,j) * b;
                    System.out.print(a + " ");
                }
                
                System.out.println();
            }
            
            sc.close();
        }
    }