MuffinMonster

Class Task 21#

Oct 28th, 2013
62
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. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int num, mone1 = 0, mone2 = 0;
  13.             num = int.Parse(Console.ReadLine());
  14.             for (; num > 0; num--)
  15.             {
  16.                 if (num % 2 == 0)
  17.                     mone1++;
  18.                 else
  19.                     mone2++;
  20.             }
  21.             Console.WriteLine(mone1 + " " + mone2);
  22.             Console.WriteLine(Math.Abs(mone2 - mone1));
  23.             Console.ReadLine();
  24.         }
  25.     }
  26. }
Add Comment
Please, Sign In to add comment