write a java program to print a multiplication table ( for loop)
Answers
Answer:
The program output is also shown below.
1) public class Multiplication_Table.
2) Scanner s = new Scanner(System.
3) System. out. print("Enter number:");
4) int n=s. nextInt();
5) for(int i=1; i <= 10; i++)
6) System. out. println(n+" * "+i+" = "+n*i);
Explanation:
Please mark as brainliest me
Answer:
This is a Java Program to Print Multiplication Table for any Number.
Enter any integer number as input of which you want multiplication table. After that we use for loop from one to ten to generate multiplication of that number.
Here is the source code of the Java Program to Print Multiplication Table for any Number. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.
import java.util.Scanner;
public class Multiplication_Table
{
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
System.out.print("Enter number:");
int n=s.nextInt();
for(int i=1; i <= 10; i++)
{
System.out.println(n+" * "+i+" = "+n*i);
}
}
}
Output:
$ javac Multiplication_Table.java
$ java Multiplication_Table
Enter number:7
7 * 1 = 7
7 * 2 = 14
7 * 3 = 21
7 * 4 = 28
7 * 5 = 35
7 * 6 = 42
7 * 7 = 49
7 * 8 = 56
7 * 9 = 63
7 * 10 = 70
Explanation:
please Mark as brainless answer