Advertisement
Shade7

2-4-8

Apr 10th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2.  
  3. class Problem1
  4. {
  5.     static void Main()
  6.     {
  7.         int A = int.Parse(Console.ReadLine());
  8.         int B = int.Parse(Console.ReadLine());
  9.         int C = int.Parse(Console.ReadLine());
  10.         long R=0;
  11.         switch (B)
  12.         {
  13.             case 2:
  14.                 R = A % C;
  15.                 break;
  16.             case 4:
  17.                 R = A + C;
  18.                 break;
  19.             case 8:
  20.                 R = A * C;
  21.                 break;
  22.             default:
  23.                 break;
  24.         }
  25.         long result;
  26.         if (R%4==0)
  27.         {
  28.             result = R / 4;
  29.         }
  30.         else
  31.         {
  32.             result = R % 4;
  33.         }
  34.         Console.WriteLine(result);
  35.         Console.WriteLine(R);
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement