Compare commits

...

12 Commits

Author SHA1 Message Date
idkWhatUserNameToUse 9813f75326 extracted method with adding issue 2023-03-23 21:08:55 +02:00
idkWhatUserNameToUse 8ae3907d24 Merge branch 'ІО-22/20-Папко-Максим' of https://github.com/ASDjonok/OOP_IO-2x_2023 into ІО-22/20-Папко-Максим 2023-03-23 20:55:22 +02:00
idkWhatUserNameToUse a011fc41cf task completed in main method 2023-03-23 20:55:11 +02:00
Maxim Papko 4454d46284
Delete Lab1 directory 2023-03-23 20:40:46 +02:00
idkWhatUserNameToUse 4d70c6a51e Merge branch 'ІО-22/20-Папко-Максим' of https://github.com/ASDjonok/OOP_IO-2x_2023 into ІО-22/20-Папко-Максим 2023-03-23 20:40:02 +02:00
idkWhatUserNameToUse 8db686fac0 determined task 2023-03-23 20:39:53 +02:00
Maxim Papko a48fb7d41f
Delete Lab1 directory 2023-03-23 20:37:22 +02:00
idkWhatUserNameToUse 09f2114de6 determined task 2023-03-23 20:35:38 +02:00
Maxim Papko 828dedc3b6
Add files via upload 2023-03-23 20:34:26 +02:00
Maxim Papko 41b6eb063c
Delete Program.cs 2023-03-23 20:31:07 +02:00
Maxim Papko bb2c8bd1a0
Add files via upload 2023-03-23 20:30:52 +02:00
idkWhatUserNameToUse 88a618647d a certain option 2023-03-23 20:29:30 +02:00
3 changed files with 113 additions and 2 deletions

View File

@ -1,2 +0,0 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

View File

@ -0,0 +1,61 @@
using System;
public class Lab1
{
public static void Main(String[] args)
{
/*o1 = +
c3 = 0
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, 1, false);
}
public static void Calculation(int A, int C, int N, short B, int M, bool divisionByZero)
{
var s = 0;
if ((A <= -C && -C <= N) || (B <= 0 && 0 <= M))
{
Console.WriteLine("Division by zero!");
return;
}
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++)
{
if (j == 0)
{
Console.WriteLine("Оскільки j = 0, то сума просто буде 0");
break;
}
s += (i * j) / (i + C);
}
}
if (!divisionByZero)
{
Console.WriteLine($"s = {s};");
}
}
}

52
laboratorna1/Program.cs Normal file
View File

@ -0,0 +1,52 @@
using System;
public class Lab1
{
public static void Main(String[] args)
{
/*o1 = +
c3 = 0
o2 = *
c7 = short */
var A = 4;
short B = 3;
var N = 10;
var M = 10;
var C = 1;
var s = 0;
bool divisionByZero=false;
if ((A <= -C && -C <= N) || (B <= 0 && 0 <= M))
{
Console.WriteLine("Division by zero!");
return;
}
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++)
{
if (j == 0) {
Console.WriteLine("Оскільки j = 0, то сума просто буде 0");
break;
}
s += (i * j) / (i + C);
}
}
if (!divisionByZero)
{
Console.WriteLine($"s = {s};" );
}
}
}