svetlozar_kirkov

2-4-8

Sep 24th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2.  
  3. namespace TwoFourEight
  4. {
  5.     class TwoFourEight
  6.     {
  7.         static void Main()
  8.         {
  9.             ulong a = ulong.Parse(Console.ReadLine());
  10.             ulong b = ulong.Parse(Console.ReadLine());
  11.             ulong c = ulong.Parse(Console.ReadLine());
  12.             ulong r = 0;
  13.             ulong result = 0;
  14.  
  15.             if (b == 2)
  16.             {
  17.                 r = a % c;
  18.             }
  19.             else if (b == 4)
  20.             {
  21.                 r = a + c;
  22.             }
  23.             else if (b == 8)
  24.             {
  25.                 r = a * c;
  26.             }
  27.  
  28.             if (r % 4 == 0)
  29.             {
  30.                 result = r / 4;
  31.                 Console.WriteLine(result);
  32.                 Console.WriteLine(r);
  33.                 return;
  34.             }
  35.             else
  36.             {
  37.                 result = r % 4;
  38.                 Console.WriteLine(result);
  39.                 Console.WriteLine(r);
  40.                 return;
  41.             }
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment