Advertisement
Vladkoheca

MultiplicationTable.java

Oct 24th, 2024
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | Source Code | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MultiplicationTable {
  4.     public static void main(String[] args) {
  5.         Scanner sc = new Scanner(System.in);
  6.  
  7.         System.out.print("Enter a number: ");
  8.         int n = sc.nextInt();
  9.         System.out.println("Multiplication table for " + n + ":");
  10.         for (int i = 1; i <= 10; i++) {
  11.             int x = n * i;
  12.             System.out.println(n + " x " + i + " = " + x);
  13.         }
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement