Advertisement
RoshHoul

Task2 08

Sep 21st, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Task2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //var collection = Console.ReadLine().Select(c => Int32.Parse(c.ToString()));
  10.             var userInput = Int32.Parse(Console.ReadLine());
  11.             int hundreds = userInput / 100;
  12.             int tens = (userInput / 10) % 10;
  13.             int singles = userInput % 10;
  14.  
  15.             int resultHundreds = ( tens + hundreds >= 10 ? ((tens+hundreds)/10 + (tens+hundreds) % 10) : (tens + hundreds));
  16.             int resultRightHalf = (singles % 2 == 0 ? singles * 2 : singles + tens);
  17.             Console.WriteLine(resultHundreds.ToString() + resultRightHalf.ToString("00"));
  18.  
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement