-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
761 lines (760 loc) · 20.1 KB
/
Program.cs
File metadata and controls
761 lines (760 loc) · 20.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
//Task 2
//
// Console.Write("Input number a: ");
// int a = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input number b: ");
// int b = Convert.ToInt32(Console.ReadLine());
// int max = a;
// if(a < b)
// {
// max = b;
// }
// Console.WriteLine($"Max = {max}");
//
//Task 4
//
// Console.Write("Input number a: ");
// int a = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input number b: ");
// int b = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input number c: ");
// int c = Convert.ToInt32(Console.ReadLine());
// int max = a;
// if(a < b)
// {
// max = b;
// }
// if(a < c)
// {
// max = c;
// }
// Console.WriteLine(max);
//
//Task 6
//
// Console.Write("Input number: ");
// int number = Convert.ToInt32(Console.ReadLine());
// bool isEven = number % 2 == 0;
// if(isEven)
// {
// Console.WriteLine("Yes");
// }
// else
// {
// Console.WriteLine("No");
// }
//
//Task 8
//
// Console.Write("Input number: ");
// int number = Convert.ToInt32(Console.ReadLine());
// int current = 1;
// while(current <= number)
// {
// if(current % 2 == 0)
// {
// Console.WriteLine(current);
// }
// current++;
// }
//
// Task 10
//
// Console.Write("Input number: ");
// int number = Convert.ToInt32(Console.ReadLine());
// int thirdChar = number % 10;
// int secondChar = ((number % 100) - thirdChar) / 10;
// Console.WriteLine(secondChar);
//
// Task 13
//
// Console.Write("Input number: ");
// string number = Console.ReadLine();
// if(number.Length <= 2)
// {
// Console.WriteLine("The number is too small");
// }
// else
// {
// Console.WriteLine(number[2]);
// }
//
// Task 13
//
// Console.Write("Input number: ");
// int number = Convert.ToInt32(Console.ReadLine());
// if(number < 100)
// {
// Console.WriteLine("The number is too small");
// }
// else
// {
// int lengthOfNumber = 0;
// int currentDigit = 1;
// while(Math.Pow(10, lengthOfNumber) < number)
// {
// lengthOfNumber++;
// currentDigit++;
// }
// for(int i = 0; i < lengthOfNumber; i++)
// {
// if(number / Math.Pow(10, i) < 1000)
// {
// number = Convert.ToInt32(Math.Truncate(number / Math.Pow(10, i)));
// int result = number % 10;
// Console.WriteLine(result);
// break;
// }
// }
// }
//
// Task 15
//
// Console.Write("Input № of day: ");
// int numberOfDay = Convert.ToInt32(Console.ReadLine());
// if(numberOfDay < 0)
// {
// Console.WriteLine("Incorrect input");
// }
// else if(numberOfDay <= 5)
// {
// Console.WriteLine("No");
// }
// else
// {
// Console.WriteLine("Yes");
// }
//
// Task 19
//
// Console.Write("Input number: ");
// string number = Console.ReadLine();
// if(number[0] == number[4] && number[1] == number[3])
// {
// Console.WriteLine("Yes");
// }
// else
// {
// Console.WriteLine("No");
// }
//
// Task 21
//
// Console.Write("Input Ox coordinate of A: ");
// int OxCoordinateOfA = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input Oy coordinate of A: ");
// int OyCoordinateOfA = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input Oz coordinate of A: ");
// int OzCoordinateOfA = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input Ox coordinate of B: ");
// int OxCoordinateOfB = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input Oy coordinate of B: ");
// int OyCoordinateOfB = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input Oz coordinate of B: ");
// int OzCoordinateOfB = Convert.ToInt32(Console.ReadLine());
// double distance = Math.Sqrt(Math.Pow(OxCoordinateOfA - OxCoordinateOfB, 2) + Math.Pow(OyCoordinateOfA - OyCoordinateOfB, 2) + Math.Pow(OzCoordinateOfA - OzCoordinateOfB, 2));
// Console.WriteLine(distance);
//
// Task 23
//
// Console.Write("Input number: ");
// int number = Convert.ToInt32(Console.ReadLine());
// for(int i = 1; i <= number; i++)
// {
// Console.Write($"{Math.Pow(i, 3)}, ");
// }
//
// Task 25
//
// Console.Write("Input number: ");
// int number = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input degree: ");
// int degree = Convert.ToInt32(Console.ReadLine());
// Console.WriteLine(Math.Pow(number, degree));
//
// Task 27
//
// Console.Write("Input number: ");
// string number = Console.ReadLine();
// double sum = 0;
// for(int i = 0; i < number.Length; i++)
// {
// sum += Char.GetNumericValue(number[i]);
// }
// Console.WriteLine(sum);
//
// Task 29
//
// int[] numbers = new int[8];
// for(int i = 0; i < numbers.Length; i++)
// {
// numbers[i] = new Random().Next(-100, 99);
// }
// Console.WriteLine($"[{string.Join(", ", numbers)}]");
//
// Task 34
//
// int[] generateArray(int length)
// {
// int[] result = new int[length];
// for(int i = 0; i < length; i++)
// {
// result[i] = new Random().Next(101, 999);
// }
// return result;
// }
// int findNumberOfEvenElements(int[] array)
// {
// int result = 0;
// for(int i = 0; i < array.Length; i++)
// {
// if(array[i] % 2 == 0)
// {
// result++;
// }
// }
// return result;
// }
// Console.Write("Input length of array: ");
// int length = Convert.ToInt32(Console.ReadLine());
// int[] array = generateArray(length);
// Console.WriteLine($"[{string.Join(", ", array)}]");
// Console.WriteLine($"Number of even elements equals to {findNumberOfEvenElements(array)}");
//
// Task 36
//
// int[] generateArray(int length)
// {
// int[] result = new int[length];
// for(int i = 0; i < length; i++)
// {
// result[i] = new Random().Next(-100, 99);
// }
// return result;
// }
// int findSumOfElementsWithOddIndexes(int[] array)
// {
// int result = 0;
// for(int i = 1; i < array.Length; i+=2)
// {
// result += array[i];
// }
// return result;
// }
// Console.Write("Input length of array: ");
// int length = Convert.ToInt32(Console.ReadLine());
// int[] array = generateArray(length);
// Console.WriteLine($"[{string.Join(", ", array)}]");
// Console.WriteLine($"Sum of elements with odd indexes equals to {findSumOfElementsWithOddIndexes(array)}");
//
// Task 38
//
// double[] generateArray(int length)
// {
// double[] result = new double[length];
// for(int i = 0; i < length; i++)
// {
// result[i] = new Random().Next(-100, 99) * Math.PI;
// }
// return result;
// }
// double getMaxElement(double[] array)
// {
// double max = array[0];
// for(int i = 0; i < array.Length; i++)
// {
// if(max <= array[i])
// {
// max = array[i];
// }
// }
// return max;
// }
// double getMinElement(double[] array)
// {
// double min = array[0];
// for(int i = 0; i < array.Length; i++)
// {
// if(min >= array[i])
// {
// min = array[i];
// }
// }
// return min;
// }
// Console.Write("Input length of array: ");
// int length = Convert.ToInt32(Console.ReadLine());
// double[] array = generateArray(length);
// Console.WriteLine($"[{string.Join(", ", array)}]");
// Console.WriteLine($"Difference between max and min elements equals to {getMaxElement(array) - getMinElement(array)}");
//
// Task 41
//
// Console.Write("Input numbers: ");
// int[] numbers = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToArray();
// int amountOfPositiveNumbers = 0;
// for(int i = 0; i < numbers.Length; i++)
// {
// if(numbers[i] >= 0)
// {
// amountOfPositiveNumbers++;
// }
// }
// Console.WriteLine(amountOfPositiveNumbers);
//
// Task 43
//
// Console.Write("Input k1: ");
// double k1 = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input b1: ");
// double b1 = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input k2: ");
// double k2 = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input b2: ");
// double b2 = Convert.ToInt32(Console.ReadLine());
// double x = (b2 - b1) / (k1 - k2);
// double y = k1 * x + b1;
// Console.WriteLine($"({x}, {y})");
//
// Task 47
//
// double[,] generateMatrixWithRealElements(int m, int n)
// {
// double[,] matrix = new double[m, n];
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j< n; j++)
// {
// matrix[i, j] = new Random().Next(-10, 9) * Math.PI;
// }
// }
// return matrix;
// }
// void showMatrix(double[,] matrix, int m, int n)
// {
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// Console.Write(matrix[i, j] + "\t");
// }
// Console.WriteLine("\n");
// }
// Console.WriteLine("\n\n");
// }
// Console.Write("Input m: ");
// int m = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input n: ");
// int n = Convert.ToInt32(Console.ReadLine());
// showMatrix(generateMatrixWithRealElements(m, n), m, n);
//
// Task 50
//
// int[,] generateMatrix(int m, int n)
// {
// int[,] matrix = new int[m, n];
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j< n; j++)
// {
// matrix[i, j] = new Random().Next(-0, 9);
// }
// }
// return matrix;
// }
// int checkElement(int[,] matrix, int m, int n, int i, int j)
// {
// if(m <= i || n <= j)
// {
// throw new Exception("There is no element with such indexes!");
// }
// return matrix[i, j];
// }
// void showMatrix(int[,] matrix, int m, int n)
// {
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// Console.Write(matrix[i, j] + "\t");
// }
// Console.WriteLine("\n");
// }
// Console.WriteLine("\n\n");
// }
// Console.Write("Input m: ");
// int m = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input n: ");
// int n = Convert.ToInt32(Console.ReadLine());
// int[,] matrix = generateMatrix(m, n);
// showMatrix(matrix, m, n);
// Console.Write("Input i: ");
// int i = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input j: ");
// int j = Convert.ToInt32(Console.ReadLine());
// Console.WriteLine(checkElement(matrix, m, n, i, j));
//
// Task 52
//
// int[,] generateMatrix(int m, int n)
// {
// int[,] matrix = new int[m, n];
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// matrix[i, j] = new Random().Next(0, 9);
// }
// }
// return matrix;
// }
// double[] findMeanValuesInRows(int[,] matrix, int m, int n)
// {
// double[] meanValues = new double[m];
// for(int i = 0; i < m; i++)
// {
// double sum = 0;
// for(int j = 0; j < n; j++)
// {
// sum += matrix[i, j];
// }
// meanValues[i] = sum / n;
// }
// return meanValues;
// }
// void showMatrix(int[,] matrix, int m, int n)
// {
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// Console.Write(matrix[i, j] + "\t");
// }
// Console.WriteLine("\n");
// }
// Console.WriteLine("\n\n");
// }
// Console.Write("Input m: ");
// int m = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input n: ");
// int n = Convert.ToInt32(Console.ReadLine());
// int[,] matrix = generateMatrix(m, n);
// showMatrix(matrix, m, n);
// Console.WriteLine($"Mean values in rows are {string.Join(", ", findMeanValuesInRows(matrix, m, n))}");
//
// Task 54
//
// int[,] generateMatrix(int m, int n)
// {
// int[,] matrix = new int[m, n];
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// matrix[i, j] = new Random().Next(0, 9);
// }
// }
// return matrix;
// }
// void sortRowsOfMatrix(int[,] matrix, int m, int n)
// {
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n - 1; j++)
// {
// if(matrix[i, j] > matrix[i, j + 1])
// {
// swapNeighborsInRow(matrix, m, n, i, j);
// }
// }
// }
// }
// void swapNeighborsInRow(int[,] matrix, int m, int n, int i, int j)
// {
// int temp = matrix[i, j];
// matrix[i, j] = matrix[i, j + 1];
// matrix[i, j + 1] = temp;
// }
// void showMatrix(int[,] matrix, int m, int n)
// {
// Console.WriteLine("\n\n");
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// Console.Write(matrix[i, j] + "\t");
// }
// Console.WriteLine("\n");
// }
// Console.WriteLine("\n");
// }
// Console.Write("Input m: ");
// int m = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input n: ");
// int n = Convert.ToInt32(Console.ReadLine());
// int[,] matrix = generateMatrix(m, n);
// showMatrix(matrix, m, n);
// sortRowsOfMatrix(matrix, m, n);
// showMatrix(matrix, m, n);
//
// Task 56
//
// int[,] generateMatrix(int m, int n)
// {
// int[,] matrix = new int[m, n];
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// matrix[i, j] = new Random().Next(0, 9);
// }
// }
// return matrix;
// }
// int findIndexOfRowWithMinSumOfElements(int[,] matrix, int m, int n)
// {
// int[] sumsOfElementsInRows = new int[n];
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// sumsOfElementsInRows[i] += matrix[i, j];
// }
// }
// return findIndexOfMinElementInArray(sumsOfElementsInRows);
// }
// int findIndexOfMinElementInArray(int[] array)
// {
// int indexOfMinElement = 0;
// for(int i = 0; i < array.Length; i++)
// {
// if(array[i] < array[indexOfMinElement])
// {
// indexOfMinElement = i;
// }
// }
// return indexOfMinElement;
// }
// void showMatrix(int[,] matrix, int m, int n)
// {
// Console.WriteLine("\n\n");
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// Console.Write(matrix[i, j] + "\t");
// }
// Console.WriteLine("\n");
// }
// Console.WriteLine("\n");
// }
// Console.Write("Input m: ");
// int m = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input n: ");
// int n = Convert.ToInt32(Console.ReadLine());
// int[,] matrix = generateMatrix(m, n);
// showMatrix(matrix, m, n);
// Console.WriteLine($"The index of row with min sum of elements is {findIndexOfRowWithMinSumOfElements(matrix, m, n)}");
//
// Task 58
//
// int[,] generateMatrix(int m, int n)
// {
// int[,] matrix = new int[m, n];
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// matrix[i, j] = new Random().Next(0, 9);
// }
// }
// return matrix;
// }
// int[,] findProductOfMatrices(int[,] firstMatrix, int[,] secondMatrix, int firstM, int firstN, int secondM, int secondN)
// {
// if(firstN != secondM)
// {
// throw new Exception("Exception: cannot find product of matrices!");
// return null;
// }
// else
// {
// int[,] product = new int[firstM, secondN];
// for(int i = 0; i < firstM; i++)
// {
// for(int j = 0; j < secondN; j++)
// {
// int sum = 0;
// for(int r = 0; r < firstN; r++)
// {
// sum += firstMatrix[i, r] * secondMatrix[r, j];
// }
// product[i, j] = sum;
// }
// }
// return product;
// }
// }
// void showMatrix(int[,] matrix, int m, int n)
// {
// Console.WriteLine("\n\n");
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// Console.Write(matrix[i, j] + "\t");
// }
// Console.WriteLine("\n");
// }
// Console.WriteLine("\n");
// }
// Console.Write("Input first m: ");
// int firstM = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input first n: ");
// int firstN = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input second m: ");
// int secondM = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input second n: ");
// int secondN = Convert.ToInt32(Console.ReadLine());
// int[,] firstMatrix = generateMatrix(firstM, firstN);
// int[,] secondMatrix = generateMatrix(secondM, secondN);
// showMatrix(firstMatrix, firstM, firstN);
// showMatrix(secondMatrix, secondM, secondN);
// showMatrix(findProductOfMatrices(firstMatrix, secondMatrix, firstM, firstN, secondM, secondN), firstM, secondN);
//
// Task 60
//
// int[,,] generateArray(int m, int n, int o)
// {
// int[,,] result = new int[m, n, o];
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// for(int k = 0; k < o; k++)
// {
// result[i, j, k] = new Random().Next(10, 40);
// }
// }
// }
// return result;
// }
// void showArray(int[,,] array, int m, int n, int o)
// {
// Console.WriteLine("\n\n");
// for(int i = 0; i < m; i++)
// {
// for(int j = 0; j < n; j++)
// {
// for(int k = 0; k < o; k++)
// {
// Console.Write($"{array[i, j, k]}({i}, {j}, {k}), ");
// }
// Console.WriteLine("\n");
// }
// }
// Console.WriteLine("\n\n");
// }
// Console.Write("Input m: ");
// int m = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input n: ");
// int n = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input o: ");
// int o = Convert.ToInt32(Console.ReadLine());
// showArray(generateArray(m, n, o), m, n, o);
//
// Task 62
//
// int[,] generateMatrix()
// {
// int[,] matrix = new int[4, 4];
// matrix[0, 0] = 1;
// matrix[0, 1] = 2;
// matrix[0, 2] = 3;
// matrix[0, 3] = 4;
// matrix[1, 3] = 5;
// matrix[2, 3] = 6;
// matrix[3, 3] = 7;
// matrix[3, 2] = 8;
// matrix[3, 1] = 9;
// matrix[3, 0] = 10;
// matrix[2, 0] = 11;
// matrix[1, 0] = 12;
// matrix[1, 1] = 13;
// matrix[1, 2] = 14;
// matrix[2, 2] = 15;
// matrix[2, 1] = 16;
// return matrix;
// }
// void showMatrix(int[,] matrix)
// {
// Console.WriteLine("\n\n");
// for(int i = 0; i < 4; i++)
// {
// for(int j = 0; j < 4; j++)
// {
// Console.Write($"{matrix[i, j]}\t");
// }
// Console.WriteLine("\n");
// }
// Console.WriteLine("\n\n");
// }
// showMatrix(generateMatrix());
//
// Task 64
//
// void printNumbers(int N)
// {
// if(N < 1)
// {
// return;
// }
// Console.Write($"{N} ");
// N--;
// printNumbers(N);
// }
// Console.Write("Input N: ");
// printNumbers(Convert.ToInt32(Console.ReadLine()));
//
// Task 66
//
// int findSum(int M, int N)
// {
// if(N == M)
// {
// return N;
// }
// return N + findSum(M, N - 1);
// }
// Console.Write("Input N: ");
// int N = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input M: ");
// int M = Convert.ToInt32(Console.ReadLine());
// Console.WriteLine($"Sum of natural numbers from M to N equals to {findSum(M, N)}");
//
// Task 68
//
// int A(int m, int n)
// {
// if(m == 0)
// {
// return n + 1;
// }
// else if(m > 0 && n == 0)
// {
// return A(m - 1, 1);
// }
// else if(m > 0 && n > 0)
// {
// return A(m - 1, A(m, n - 1));
// }
// else
// {
// return 0;
// }
// }
// Console.Write("Input m: ");
// int m = Convert.ToInt32(Console.ReadLine());
// Console.Write("Input n: ");
// int n = Convert.ToInt32(Console.ReadLine());
// Console.WriteLine(A(m, n));