Advertisement
ivan_yosifov

2_4_8

Dec 9th, 2013
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using System;
  2.  
  3. class TwoFourEight
  4. {
  5.     static void Main()
  6.     {
  7.         long A = long.Parse(Console.ReadLine());
  8.         long B = long.Parse(Console.ReadLine());
  9.         long C = long.Parse(Console.ReadLine());
  10.        
  11.         long R = 0;
  12.         long result = 0;
  13.  
  14.         if (B == 2) R = A % C;
  15.         else if (B == 4) R = A + C;
  16.         else if (B == 8) R = A * C;
  17.  
  18.         if (R % 4 == 0) result = R / 4;
  19.         else result = R % 4;
  20.  
  21.         Console.WriteLine(result);
  22.         Console.WriteLine(R);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement