public class Main { public static void main(String args[]) { int x,n=5; for(x=1; x<=10; x++) { System.out.println(x+" * "+n+" = "+(x*n)); } } }
1 * 5 = 5
2 * 5 = 10
3 * 5 = 15
4 * 5 = 20
5 * 5 = 25
6 * 5 = 30
7 * 5 = 35
8 * 5 = 40
9 * 5 = 45
10 * 5 = 50
public class Main { public static void main(String args[]) { int x,n; n=Integer.parseInt(args[0]); for(x=1; x<=10; x++) { System.out.println(x+" * "+n+" = "+(x*n)); } } }
1 * 5 = 5
2 * 5 = 10
3 * 5 = 15
4 * 5 = 20
5 * 5 = 25
6 * 5 = 30
7 * 5 = 35
8 * 5 = 40
9 * 5 = 45
10 * 5 = 50
import java.util.*; public class Main { public static void main(String args[]) { int x,n; Scanner s=new Scanner(System.in); System.out.println("Enter n value"); n=s.nextInt(); for(x=1; x<=10; x++) { System.out.println(x+" * "+n+" = "+(x*n)); } } }
Enter n value : 5
1 * 5 = 5
2 * 5 = 10
3 * 5 = 15
4 * 5 = 20
5 * 5 = 25
6 * 5 = 30
7 * 5 = 35
8 * 5 = 40
9 * 5 = 45
10 * 5 = 50