
In Java, loops are used to execute a block of code repeatedly based on a certain condition. There are several types of loops available in Java:
for loop: The for
loop is commonly used when you know the number of iterations in advance. It has three parts: initialization, condition, and increment and decrement. The loop will continue executing as long as the condition is true. Here’s the syntax
import java.util.Scanner;
public class Example{
public static void main(String []args){
Scanner Sc = new Scanner(System.in);
System.out.println("enter the number");
int a = Sc.nextInt();
for(int i=1; i<11; i++){
System.out.println(a*i);
}
}
}

Without using Scanner
public class Table {
public static void main(String []args){
int n = 2;
for(int i=1; i<11;i++) {
System.out.println(i*n);
}
}
}