
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# Program to Display a String in Reverse Alphabetic Order
Set a string array and convert it to character array −
string str = "Amit"; char[] arr = str.ToCharArray();
Now, use the Reverse method to display the above string in reverse alphabetic order −
Array.Reverse(arr);
Here is the complete code −
Example
using System; using System.Linq; using System.IO; class Program { static void Main() { string str = "Amit"; char[] arr = str.ToCharArray(); Console.WriteLine("Original String: "+str); // Reverse Array.Reverse(arr); Console.WriteLine("Reversed String: "+new string(arr)); } }
Output
Original String: Amit Reversed String: timA
Advertisements