Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- int salt = int.Parse(Console.ReadLine());
- string text = Console.ReadLine();
- int position = 0;
- foreach (char symbol in text)
- {
- if (symbol == '@')
- {
- break;
- }
- else if (symbol >= 'A' && symbol <= 'z')
- {
- int letter = Convert.ToInt32(symbol);
- int letterSum = (letter * salt) + 1000;
- double finalSumLetter = 0;
- position++;
- if (position % 2 == 0)
- {
- finalSumLetter = letterSum * 100;
- Console.WriteLine(finalSumLetter);
- }
- else
- {
- finalSumLetter = letterSum / 100.00;
- Console.WriteLine("{0:F2}", finalSumLetter);
- }
- }
- else if (symbol == '0' || symbol == '1' || symbol == '2' || symbol == '3' || symbol == '4' || symbol == '5' || symbol == '6' || symbol == '7' || symbol == '8' || symbol == '9')
- {
- int currentNumber = symbol + salt + 500;
- double finalSumNumber = 0;
- position++;
- if (position % 2 == 0)
- {
- finalSumNumber = currentNumber * 100;
- Console.WriteLine(finalSumNumber);
- }
- else
- {
- finalSumNumber = currentNumber / 100.00;
- Console.WriteLine("{0:F2}", finalSumNumber);
- }
- }
- else
- {
- int anyOtherSymbol = (Convert.ToInt32(symbol) - salt);
- double sumAnyOtherSymbol = 0;
- position++;
- if (position % 2 == 0)
- {
- sumAnyOtherSymbol = anyOtherSymbol * 100;
- Console.WriteLine(sumAnyOtherSymbol);
- }
- else
- {
- sumAnyOtherSymbol = anyOtherSymbol / 100.00;
- Console.WriteLine("{0:F2}", sumAnyOtherSymbol);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement