Advertisement
Guest User

Untitled

a guest
Dec 26th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         int k = 0;
  8.         int max = 0;
  9.         int numstr = 0;
  10.         int[,] msv = { { 4, 0, 1, 8 },
  11.                        { 7, 7, 7, 7 },
  12.                        { 3, 5, 5, 8 }
  13.                        
  14.                       };
  15.         for (int i = 0; i < 3; i++)
  16.         {
  17.         k = 0;
  18.             for (int j = 0; j < 3; j++)
  19.             {
  20.                 if (msv[i, j] == msv[i, j + 1])
  21.                 {
  22.                     k++;
  23.                 if (k > max)
  24.                 {
  25.                 max = k;
  26.                 numstr = i;
  27.                 }  
  28.                 } else k=0;
  29.                
  30.             }
  31.              
  32.         }      
  33.         Console.WriteLine("Номер строки"+ numstr);
  34.        
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement