namereq

Untitled

Jun 12th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1.         static void Main(string[] args)
  2.         {
  3.             Console.WriteLine("26進数に変換したい数字を入れてください。");
  4.             string str = Console.ReadLine();
  5.             int value = int.Parse(str);
  6.            
  7.             List<char> vs = new List<char>();
  8.             for(;value > 0; value /= 26) {
  9.                 int keta = value % 26;
  10.                 vs.Add((char)((int)'A' + keta));
  11.             }
  12.             vs.Reverse();
  13.             Console.WriteLine(vs.ToArray());
  14.  
  15.             Console.ReadLine();
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment