mirror of
https://github.com/svek95/programming_GB.git
synced 2026-05-17 18:41:44 +03:00
add HW9
This commit is contained in:
+15
@@ -336,6 +336,21 @@
|
||||
return snakeArray;
|
||||
}
|
||||
|
||||
public int Task_64(int number)
|
||||
{
|
||||
if (number / 10 != 0)
|
||||
return 1 + Task_64(number / 10);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int Task_66(int M, int N)
|
||||
{
|
||||
if (N == M-1)
|
||||
return 0;
|
||||
return N + Task_66(M, N-1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -41,3 +41,8 @@
|
||||
- [X] Task_54
|
||||
- [X] Task_56
|
||||
- [X] Task_62
|
||||
|
||||
|
||||
## HW9
|
||||
- [X] Task_64
|
||||
- [X] Task_66
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Start
|
||||
Tools myTools = new Tools();
|
||||
|
||||
Console.Write("Wich task: ");
|
||||
Console.WriteLine("WH8 is 54, 56, 62");
|
||||
Console.WriteLine("WH9 is 64, 66");
|
||||
// Console.WriteLine("WH3 is 19, 23");
|
||||
int taskNumver = Convert.ToInt32(Console.ReadLine());
|
||||
switch (taskNumver)
|
||||
@@ -176,6 +176,20 @@ public class Start
|
||||
myTools.ShowInt2dArray(HW.Task_62(n));
|
||||
break;
|
||||
|
||||
case 64:
|
||||
Console.WriteLine("Input number: ");
|
||||
int number64 = Convert.ToInt32(Console.ReadLine());
|
||||
Console.WriteLine("Count numbers is: "+HW.Task_64(number64));
|
||||
break;
|
||||
|
||||
case 66:
|
||||
Console.WriteLine("Input M: ");
|
||||
int M = Convert.ToInt32(Console.ReadLine());
|
||||
Console.WriteLine("Input N: ");
|
||||
int N = Convert.ToInt32(Console.ReadLine());
|
||||
Console.WriteLine("Summ is: "+HW.Task_66(M, N)+ $" between numbers {M} and {N} ");
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 100:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user