Guest User

3-6-9

a guest
Apr 2nd, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  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.  
  11.         int r = 0;
  12.  
  13.         if(b == 3)
  14.         {
  15.             r = a + c;
  16.         }
  17.         else if(b == 6)
  18.         {
  19.             r = a * c;
  20.         }
  21.         else if(b == 9)
  22.         {
  23.             r = a % c;
  24.         }
  25.  
  26.         if(r % 3 == 0)
  27.         {
  28.             Console.WriteLine(r / 3);
  29.         }
  30.         else
  31.         {
  32.             Console.WriteLine(r % 3);
  33.         }
  34.         Console.WriteLine(r);
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment