MuffinMonster

Class Task 23#

Oct 28th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication3
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int num1, num2, mone1, mone2, max1 = 0, max2 = 0;
  13.             for (int i = 0; i < 20; i++)
  14.             {
  15.                 num1 = int.Parse(Console.ReadLine());
  16.                 num2 = int.Parse(Console.ReadLine());
  17.                 while (num1 > 0)
  18.                 {
  19.                     mone1 = num1 % 10;
  20.                     max1 = Math.Max(max1, mone1);
  21.                     num1 = num1 / 10;
  22.                 }
  23.                 while (num2 > 0)
  24.                 {
  25.                     mone2 = num2 % 10;
  26.                     max2 = Math.Max(max2, mone2);
  27.                     num2 = num2 / 10;
  28.                 }
  29.                 Console.WriteLine((max2 + max1) / 2);
  30.             }
  31.         }
  32.     }
  33. }
Add Comment
Please, Sign In to add comment