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
@@ -335,6 +335,21 @@
|
|||||||
|
|
||||||
return snakeArray;
|
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_54
|
||||||
- [X] Task_56
|
- [X] Task_56
|
||||||
- [X] Task_62
|
- [X] Task_62
|
||||||
|
|
||||||
|
|
||||||
|
## HW9
|
||||||
|
- [X] Task_64
|
||||||
|
- [X] Task_66
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class Start
|
|||||||
Tools myTools = new Tools();
|
Tools myTools = new Tools();
|
||||||
|
|
||||||
Console.Write("Wich task: ");
|
Console.Write("Wich task: ");
|
||||||
Console.WriteLine("WH8 is 54, 56, 62");
|
Console.WriteLine("WH9 is 64, 66");
|
||||||
// Console.WriteLine("WH3 is 19, 23");
|
// Console.WriteLine("WH3 is 19, 23");
|
||||||
int taskNumver = Convert.ToInt32(Console.ReadLine());
|
int taskNumver = Convert.ToInt32(Console.ReadLine());
|
||||||
switch (taskNumver)
|
switch (taskNumver)
|
||||||
@@ -175,6 +175,20 @@ public class Start
|
|||||||
int n = Convert.ToInt32(Console.ReadLine());
|
int n = Convert.ToInt32(Console.ReadLine());
|
||||||
myTools.ShowInt2dArray(HW.Task_62(n));
|
myTools.ShowInt2dArray(HW.Task_62(n));
|
||||||
break;
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
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