Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Anacci
- {
- static void Main()
- {
- char firstLetter = char.Parse(Console.ReadLine());
- char secondLetter = char.Parse(Console.ReadLine());
- byte L = byte.Parse(Console.ReadLine());
- int firstIndex = (int)firstLetter - 64;
- int secondIndex = (int)secondLetter - 64;
- Console.WriteLine((char)(firstIndex + 64));
- if (L != 1)
- {
- for (int i = 1; i < L; i++)
- {
- for (int j = 0; j <= 1; j++)
- {
- int newIndex = firstIndex + secondIndex;
- if (newIndex > 26)
- {
- newIndex %= 26;
- }
- firstIndex = secondIndex;
- secondIndex = newIndex;
- if (j > 0) {
- string whitespaces = new string(' ', i - 1);
- Console.Write(whitespaces);
- }
- Console.Write((char)(firstIndex + 64));
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment