Advertisement
ivanov_ivan

ThreeEqualNumber

Jan 31st, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Numerics;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace Test
  10. {
  11.     class ThreeEqualNumber
  12.     {
  13.         static void Main()
  14.         {
  15.             string a = Console.ReadLine();
  16.             string b = Console.ReadLine();
  17.             string c = Console.ReadLine();
  18.             int maxLength = Math.Max(a.Length , Math.Max(b.Length , c.Length));
  19.             bool areEqual = true;
  20.  
  21.             a = a.PadRight(maxLength , '0');
  22.             b = b.PadRight(maxLength , '0');
  23.             c = c.PadRight(maxLength , '0');
  24.  
  25.             for(int i = 0; i < maxLength; i++)
  26.             {
  27.                 if(a[i]!= b[i] || b[i]!=c[i])
  28.                 {
  29.                     areEqual = false;
  30.                 }
  31.             }
  32.  
  33.             if(areEqual)
  34.             {
  35.                 Console.WriteLine("yes");
  36.             }
  37.             else
  38.             {
  39.                 Console.WriteLine("no");
  40.             }
  41.         }    
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement