Compare commits

..

No commits in common. "14c58d0cc4bceaee82b838bf10ee7c7aabc65d5e" and "41ad598b7951ccbf43c17c5a4e2a9f573482177a" have entirely different histories.

2 changed files with 11 additions and 61 deletions

View File

@ -1,17 +1,7 @@
public class Lab1 {
public static void main(String[] args) {
// char c = 'a' + '1';
char c = 97;
// char c = '1';
System.out.println(c);
System.out.println((int) c);
c++;
System.out.println(c);
System.out.println((int) c);
System.out.println((double)'1'/'3');
// System.out.println( (double) 0 / 0 );
// System.out.println( Math.sqrt(-1) );
System.out.println( (double) 0 / 0 );
System.out.println( Math.sqrt(-1) );
double s = 0;
/*for (int i = 1; i <= 3; i++) { // 1) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> i = 1, 2) <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <= 3, 3) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䳿 <EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
System.out.println(i); // 4) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD> 1, 5) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2
@ -22,37 +12,23 @@ public class Lab1 {
for (int i = 0; i < array.length; i++) {
}*/
final int A = -3;
final int B = 0;
final int A = -1;
final int B = 1;
final int N = 2;
final int M = 2;
final int C = 1;
// boolean wasDivisionByZero = false;
// todo char
// todo[clear code] think about avoiding brackets
if ((A <= -C && -C <= N) || (B <= 0 && 0 <= M)) {
System.out.println("Division by zero!");
return;
}
/*myLabel:*/for (int i = A; i <= N /*&& !wasDivisionByZero*/; i++) {
/*if (i + C == 0) { // todo optimize
for (int i = A; i <= N; i++) {
if (i + C == 0) { // todo optimize
System.out.println("Division by zero!");
wasDivisionByZero = true;
break; //todo flag vs return;
}*/
}
for (int j = B; j <= M; j++) {
/*if (j == 0) {
System.out.println("Division by zero!");
return;
// wasDivisionByZero = true;
// break myLabel;
}*/
s += (double) (i / j) / (i + C);
s += (double) (i + j) / (i + C);
}
}
// if (!wasDivisionByZero) {
System.out.println("s = " + s);
// }
System.out.println("s = " + s);
}
}

View File

@ -1,26 +0,0 @@
public class Lab2 {
public static void main(String[] args) {
int[] array = {1, 2, 3};
/*for (int i = 0; i < array.length; i++) {
if (i % 2 == 0) {
System.out.println("!" + array[i]);
} else {
System.out.println("?" + array[i]);
}
}*/
for (int i = 0; i < array.length; i+=2) {
System.out.println("!" + array[i]);
}
for (int i = 1; i < array.length; i+=2) {
System.out.println("?" + array[i]);
}
// зубчасті матриці
int[][] matrix = {
{1, 2},
{3}
};
}
}