Skip to content

Instantly share code, notes, and snippets.

@aurorapar
Created April 27, 2017 18:15
Show Gist options
  • Save aurorapar/b4ccbdf46a21112f1537b0894db8c748 to your computer and use it in GitHub Desktop.
Save aurorapar/b4ccbdf46a21112f1537b0894db8c748 to your computer and use it in GitHub Desktop.
import java.util.*;
class tables
{
public static void main(String[] args)
{
Random rng = new Random();
for(int i = 1; i <= 10; i += 1)
{
for(int j = 1; j <= 10; j += 1)
{
int m = rng.nextInt(8) + 1;
System.out.print(" "+Integer.toString(m));
System.out.print(" ");
}
System.out.println();
for(int j = 1; j <= 10; j += 1)
{
int m = rng.nextInt(8) + 1;
System.out.print("+ "+Integer.toString(m));
System.out.print(" ");
}
System.out.println();
for(int j = 1; j <= 10; j += 1)
{
System.out.print("___");
System.out.print(" ");
}
System.out.println();
System.out.println();
System.out.println();
}
System.out.println();
int[] n = new int[10];
for(int i = 1; i <= 10; i += 1)
{
for(int j = 1; j <= 10; j += 1)
{
n[i-1] = rng.nextInt(25) + 5;
if(n[i-1] < 10)
{
System.out.print(" "+Integer.toString(n[i-1]));
}
if(n[i-1] > 9)
{
System.out.print(" "+Integer.toString(n[i-1]));
}
System.out.print(" ");
}
System.out.println();
for(int j = 1; j <= 10; j += 1)
{
int m = rng.nextInt(7) + 2;
while(n[i-1] < m)
{
m = rng.nextInt(8) + 1;
}
System.out.print("- "+Integer.toString(m));
System.out.print(" ");
}
System.out.println();
for(int j = 1; j <= 10; j += 1)
{
System.out.print("___");
System.out.print(" ");
}
System.out.println();
System.out.println();
System.out.println();
}
System.out.println();
for(int i = 1; i <= 10; i += 1)
{
for(int j = 1; j <= 10; j += 1)
{
int m = rng.nextInt(8) + 1;
System.out.print(" "+Integer.toString(m));
System.out.print(" ");
}
System.out.println();
for(int j = 1; j <= 10; j += 1)
{
int m = rng.nextInt(8) + 1;
System.out.print("* "+Integer.toString(m));
System.out.print(" ");
}
System.out.println();
for(int j = 1; j <= 10; j += 1)
{
System.out.print("___");
System.out.print(" ");
}
System.out.println();
System.out.println();
System.out.println();
}
System.out.println();
for(int i = 1; i <= 10; i += 1)
{
for(int j = 1; j <= 10; j += 1)
{
System.out.print(" ___");
System.out.print(" ");
}
System.out.println();
for(int j = 1; j <= 10; j += 1)
{
int k = rng.nextInt(7) + 2;
System.out.print(Integer.toString(k)+ ")");
int m = rng.nextInt(25) + 5;
int l = m % k;
while(l != 0)
{
m = rng.nextInt(25) + 5;
if(m <= k)
{
m = rng.nextInt(25) + 5;
}
l = m % k;
}
if(m > 9)
{
System.out.print(Integer.toString(m));
System.out.print(" ");
}
if(m < 10)
{
System.out.print(" "+Integer.toString(m)+ " ");
}
}
System.out.println();
System.out.println();
System.out.println();
System.out.println();
}
System.out.println();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment