SHARE
TWEET

Reverse String

sylviapsh Jan 28th, 2013 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. class ReverseStringLetters
  4. {
  5.   //Write a program that reads a string, reverses it and prints the result at the console.
  6.   //Example: "sample" -> "elpmas".
  7.  
  8.   static void Main()
  9.   {
  10.     Console.WriteLine("Enter a string to reverse: ");
  11.     string input = Console.ReadLine();
  12.    
  13.     for (int i = input.Length - 1; i >= 0; i--)
  14.     {
  15.       Console.Write(input[i]);
  16.     }
  17.     Console.WriteLine();
  18.   }
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top