package multiplicationtable;
import java.util.Scanner;
/**
 *
 * @author Student
 */
public class MultiplicationTable{
 Â
 Â
  /**
   * @param args the command line arguments
   */
  public static void main(String[] args) {
    System.out.println("Enter a number to display multiplication table\n");
    Scanner input = new Scanner(System.in);
   // System.out.println("Enter the starting
   int n = input.nextInt();
  Â
    System.out.print("---------------------------------\n");
   for(int i = 1; i<=n; i++){
     System.out.print(i +"\t");
   }
   System.out.print("\n");
    System.out.print("---------------------------------\n");
   int a = n + 1;
   for(int i=1; i<=a; i++){
    Â
     for(int j=1; j<=a; j++){
       // System.out.print(j +"\n");
     Â
       if(j == a ){
        Â
         System.out.print("\t");
         System.out.print("\n");
       }
       else{
        System.out.print((j * i)+"\t"); Â
       }
      Â
      // System.out.print(" ");
     }
   }
   Â
  }
  Â
}
Comments
Leave a comment