Advertisement
radidim

P05.Messages (C# Shell App Paste)

Jul 16th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
  2. using System;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Collections.Generic;
  6.  
  7. namespace CSharp_Shell
  8. {
  9.  
  10.     public static class Program
  11.     {
  12.         public static void Main()
  13.         {
  14.            int input = int.Parse(Console.ReadLine());
  15.            string message = string.Empty;
  16.            for(int i=0;i<input;i++)
  17.            {
  18.             string digits = Console.ReadLine();
  19.             int mainDigit = digits[0]-'0';
  20.            
  21.             int lenght = digits.Length;
  22.             int offset = (mainDigit-2)*3;
  23.             int index= offset+(lenght-1);
  24.             if(mainDigit==0)
  25.             {
  26.                 message +=(char)(index+32);
  27.                 continue;
  28.             }
  29.            
  30.             if(mainDigit == 7 || mainDigit== 9);
  31.             {
  32.                 offset++;
  33.             }
  34.            
  35.             message += (char)(index+97);
  36.            
  37.            }
  38.            Console.WriteLine(message);
  39.            
  40.            
  41.            
  42.         }
  43.        
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement