- 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...
-
Problem statement: what would be the better option to choose between char[] array and String. Answer: Character array i.e. char[] over ...
-
Problem statement: In a dark room,there is a box of 18 white and 5 black gloves. You are allowed to pick one and then you are allowed to k...
-
अपनी धुन में रहता हूँ मैं भी तेरे जैसा हूँ ओ पिछली रुत के साथी अब के बरस मैं तनहा हूँ अपनी धुन में... तेरी गली में सारा दिन दुख के कंकर ...


No comments:
Post a Comment