We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Java
- Introduction
- Java Loops I
- Discussions
Java Loops I
Java Loops I
Sort by
recency
|
1433 Discussions
|
Please Login in order to post a comment
import java.io.; import java.math.; import java.security.; import java.text.; import java.util.; import java.util.concurrent.; import java.util.function.; import java.util.regex.; import java.util.stream.*; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList;
public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
}
/*This is the simple and easy method to solve this question, i just simply run loop with the 2 number given in problem set and do arithematic calculation and then print as per the guideline, I use for loop cause i know how many time loop is going to run then this section is more easy to understand which i given below: Syntax of for loops:
System.out.println(n + " x " + i + " = " + (n * i)); n + " x " When you use + with a number and a string, Java converts the number to text and concatenates. If n is 5, this produces "5 x ". + i + " = " Next, Java takes that result and appends the current loop index i, then the literal " = ". If i is 3, you now have "5 x 3 = ". + (n * i) The expression inside parentheses (n * i) is evaluated first (so you multiply two integers). If n = 5 and i = 3, that gives 15, which is then converted to the string "15" and appended. System.out.println(...) Finally, println prints that full string and moves to a new line. Putting it all together, when n = 5 and i = 3, you get: Copy code 5 x 3 = 15 .................................................................If you like my solution,approach hit the one like for appreciation. */
import java.util.Scanner;
public class hackerrankloop { public static void main(String[] args) { Scanner sc = new Scanner(System.in);
}
java 15