- import jaa.util.Scanner;
- public class LoopAlgorithm {
- public static void main(String[] args) {
- 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 result = 0;
- for (int j = 0; j < n; j++) {
- if (j == 0) {
- result = (result +a + (int) (Math.pow(2, j) * b));
- } else {
- result = (int) Math.pow(2, j) * b;
- System.out.println(result+" ");
- }
- }
- System.out.print("");
- }
- in.close();
- }
- }
Tuesday, April 23, 2019
Java Loop
Subscribe to:
Post Comments (Atom)
How to run standalone mock server on local laptop
Please download the standalone wiremock server from Direct download section at the bottom of the page. Download and installation Feel fre...
-
Cryptography or cryptology (from Ancient Greek: kryptós "hidden, secret"; graphein, "to write") is the practice and stu...
-
Problem statement: what would be the better option to choose between char[] array and String. Answer: Character array i.e. char[] over ...
-
Please download the standalone wiremock server from Direct download section at the bottom of the page. Download and installation Feel fre...
No comments:
Post a Comment