Revert "reviwed and fixed lab1"

This reverts commit c95a243c84.
This commit is contained in:
idkWhatUserNameToUse 2023-04-14 20:07:51 +03:00
parent c95a243c84
commit d1e20c015c
1 changed files with 22 additions and 7 deletions

View File

@ -9,14 +9,24 @@ public class Lab1
o2 = *
c7 = short */
// var A = 4;
// short B = 3;
// var N = 10;
// var M = 10;
//
// var C = 1;
// var s = 0;
//
// bool divisionByZero=false;
calculation(4, 3, 10, 10, 11, false);
Calculation(4, 3, 10, 10, 1, false);
}
public static void calculation(int A, int C, int N, short B, int M, bool divisionByZero)
public static void Calculation(int A, int C, int N, short B, int M, bool divisionByZero)
{
double s = 0;
if (A <= -C && -C <= N)
var s = 0;
if ((A <= -C && -C <= N) || (B <= 0 && 0 <= M))
{
Console.WriteLine("Division by zero!");
return;
@ -24,7 +34,12 @@ public class Lab1
for (int i = A; i <= N; i++)
{
if (i + C == 0)
{
Console.WriteLine("Division by zero!");
divisionByZero = true;
break;
}
for (short j = B; j <= M; j++)
{
@ -34,7 +49,7 @@ public class Lab1
break;
}
s +=(double)(i * j) / (i + C);
s += (i * j) / (i + C);
}
}