Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _03._ReversedString
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine(); //"Desi" -> "iseD"
- Console.WriteLine(reverseString(input));
- }
- static string reverseString(string text)
- {
- //text = "table";
- string reversedString = ""; //обърнатия текст -> "elbat"
- //от последния към първия символ
- for (int position = text.Length - 1; position >= 0; position--)
- {
- char currentSymbol = text[position];
- reversedString += currentSymbol;
- }
- return reversedString;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment