praktikum4 ülessanded
This commit is contained in:
@@ -0,0 +1 @@
|
||||
bin/
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
package praktikum4;
|
||||
|
||||
public class pangapass {
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (int i = 0; i <= 9999; i++) {
|
||||
System.out.printf("%04d%n", i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,28 +3,35 @@ package praktikum4;
|
||||
public class table2 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.printf("Tabeli X suurus: ");
|
||||
System.out.printf("Tabeli suurus: ");
|
||||
int x_size = lib.TextIO.getlnInt(); // table size in x direction
|
||||
System.out.printf("Tabeli Y suurus: ");
|
||||
int y_size = lib.TextIO.getlnInt(); // table size in y direction
|
||||
int y_size = x_size; // table size in y direction
|
||||
|
||||
// Create the table
|
||||
System.out.printf("--");
|
||||
for (int x = 0; x <= x_size; x++) {
|
||||
System.out.printf("--");
|
||||
}
|
||||
System.out.printf("%n");
|
||||
System.out.printf("-%n");
|
||||
for (int x = 0; x <= x_size; x++) {
|
||||
System.out.printf("| ");
|
||||
for (int y = 0; y <= y_size; y++) {
|
||||
if (x == y) {
|
||||
System.out.printf("1 ");
|
||||
if (x==y) {
|
||||
System.out.printf("x ");
|
||||
} else if (y+x == x_size) {
|
||||
System.out.printf("x ");
|
||||
} else {
|
||||
System.out.printf("0 ");
|
||||
}
|
||||
|
||||
}
|
||||
//we are at the end of the line, start a new one
|
||||
System.out.printf("%n");
|
||||
System.out.printf("|%n");
|
||||
}
|
||||
System.out.printf("--");
|
||||
for (int x = 0; x <= x_size; x++) {
|
||||
System.out.printf("--");
|
||||
}
|
||||
System.out.printf("-%n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package praktikum4;
|
||||
|
||||
public class table3 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
int x_size = 9;
|
||||
int y_size = x_size; // table size in y direction
|
||||
|
||||
// Create the table
|
||||
System.out.printf("%n");
|
||||
for (int x = 0; x <= x_size; x++) {
|
||||
for (int y = 0; y <= y_size; y++) {
|
||||
if (x+y > 9) {
|
||||
System.out.printf("%d ", y+x-10);
|
||||
} else {
|
||||
System.out.printf("%d ", y+x);
|
||||
}
|
||||
|
||||
}
|
||||
//we are at the end of the line, start a new one
|
||||
System.out.printf("%n");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user