I want to generate the multiplication table of between the range
for which I use two variable start
and end
eg. start=1 and end=5 i.e. multiplication table from 1 to 5
I am using nested for loops
inner for loop which is j is use to multiple start number from 1 to 10
so insted of generating 1 to 5
it is generating 1 table 5 times
here is my code
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int start, end;
Scanner sc = new Scanner(System.in);
System.out.print("Enter the start number :- ");
start = sc.nextInt();
System.out.print("nEnter the end number :- ");
end = sc.nextInt();
int i;
for (i = start; i <= end; i++) {
for (int j = 1; j <= 10; j++) {
System.out.println(start + " * " + j + " = " + (i * j));
}
System.out.println("-----------------------------");
}
}
}
1