Advertisement
BojidarDosev

zadacha 2

Oct 25th, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.48 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp6
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[,] array = new int[6, 6];
  14.             string s; int sum = 0; int sumAll = 0;
  15.             for (int i = 0; i < 6; i++)
  16.             {
  17.                 for (int j = 0; j < 6; j++)
  18.                 {
  19.                     array[i, j] = int.Parse(Console.ReadLine());
  20.                 }
  21.             }
  22.             Console.WriteLine();
  23.             for (int i = 0; i < 6; i++)
  24.             {
  25.                 s = "";
  26.                 for (int j = 0; j < 6; j++)
  27.                 {
  28.                     s += String.Format("{0,4}", array[i, j]);
  29.                 }
  30.                 Console.WriteLine(s);
  31.             }
  32.             for (int i = 0; i < 6; i++)
  33.             {
  34.                 sum = 0;
  35.                 for (int j = 0; j < 6; j++)
  36.                 {
  37.                     if (array[i, j] % 2 == 1)
  38.                     {
  39.                         sum += array[i, j];
  40.                         Console.Write(array[i, j] + " ");
  41.                     }
  42.                 }
  43.                 Console.WriteLine(sum);
  44.                 sumAll += sum;
  45.             }
  46.             Console.WriteLine(sumAll);
  47.         }
  48.     }
  49. }
  50. /*
  51. 11
  52. 12
  53. 13
  54. 14
  55. 15
  56. 16
  57. 21
  58. 22
  59. 23
  60. 24
  61. 25
  62. 26
  63. 31
  64. 32
  65. 33
  66. 34
  67. 35
  68. 36
  69. 41
  70. 42
  71. 43
  72. 44
  73. 45
  74. 46
  75. 51
  76. 52
  77. 53
  78. 54
  79. 55
  80. 56
  81. 61
  82. 62
  83. 63
  84. 64
  85. 65
  86. 66
  87. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement