Teo_Yanchev

TextProcessing - 01. ReverseWord - C# Fundamentals

Oct 24th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. using System;
  2.  
  3. namespace TextProcessing___Lab
  4. {
  5. class ReverseWord
  6. {
  7. static void Main()
  8. {
  9. string command = Console.ReadLine();
  10. while (command != "end")
  11. {
  12.  
  13. Console.WriteLine($"{command} = {Reverse(command)}");
  14. command = Console.ReadLine();
  15. }
  16. }
  17. public static string Reverse(string word)
  18. {
  19. char[] charArray = word.ToCharArray();
  20. Array.Reverse(charArray);
  21. return new string(charArray);
  22. }
  23. }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment