Created
July 27, 2018 23:58
-
-
Save AbdullahMagat/6df01b6d2b8ed0895c205f0ea862581a to your computer and use it in GitHub Desktop.
Hackerrank Java Loops II
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
class Solution{ | |
public static void main(String []argh){ | |
Scanner in = new Scanner(System.in); | |
int t=in.nextInt(); | |
for(int i=0;i<t;i++){ | |
int a = in.nextInt(); | |
int b = in.nextInt(); | |
int n = in.nextInt(); | |
int res=a; | |
for(int j=0;j<n;j++){ | |
res=res+b*(int)Math.pow(2,j); | |
System.out.print(res +" "); | |
} | |
System.out.println(); | |
} | |
in.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment