Advertisement
Shubhra_Sarker

Multiplication TableGeneration

Feb 28th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class MulTableGeneration
  5. {
  6.     int[][] A= new  int[1000][1000];
  7.     int row, col;
  8.     MulTableGeneration(int row, int col)
  9.     {
  10.         this.row=row;
  11.         this.col=col;
  12.         for(int i=0; i <=row;i++)
  13.         {
  14.             for(int j=0; j<=col;j++)
  15.             {
  16.                 A[i][j] = i*j;
  17.             }
  18.         }
  19.     }
  20.    
  21.     void Show()
  22.     {
  23.         for(int i=0; i <=row;i++)
  24.         {
  25.             for(int j=0; j<=col;j++)
  26.             {
  27.                 System.out.print(A[i][j] +" ");
  28.             }
  29.             System.out.println();
  30.         }
  31.     }
  32.     /**
  33.      * @param args
  34.      */
  35.     public static void main(String[] args)
  36.     {
  37.         System.out.println("Enter Row: ");
  38.         Scanner sc = new Scanner(System.in);
  39.         int i=sc.nextInt();
  40.        
  41.         System.out.println("Enter Colum: ");
  42.         int j=sc.nextInt();
  43.         // TODO Auto-generated method stub
  44.         MulTableGeneration ml =new MulTableGeneration(i, j);
  45.         ml.Show();
  46.     }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement