Skip to content

Instantly share code, notes, and snippets.

@pepet96
Created February 13, 2014 03:33
Show Gist options
  • Save pepet96/8969307 to your computer and use it in GitHub Desktop.
Save pepet96/8969307 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class table {
public static void main (String [] args) {
Scanner input = new Scanner(System.in);
int params = input.nextInt();
int[][] n = new int[params][params];
n = initialize(params);
for (int row = 0; row < n.length ; row++)
{
for (int column = 0; column < n[row].length; column++)
{
System.out.print(n[row][column]);
}
System.out.println();
}
}
public static int[][] initialize(int params)
{
int [][] hello = new int[params][params];
for (int row = 0; row < hello.length ; row++)
{
for (int column = 0; column < hello[row].length; column++)
{
hello[row][column] = (row+1)*(column+1);
}
}
return hello;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment