C# Sharp Exercises: Print individual characters of the string in reverse order
C# Sharp String: Exercise-4 with Solution
Write a program in C# Sharp to print individual characters of the string in reverse order.
Sample Solution:-
C# Sharp Code:
using System;
public class Exercise4
{
public static void Main()
{
string str;
int l=0;
Console.Write("\n\nprint individual characters of string in reverse order :\n");
Console.Write("------------------------------------------------------\n");
Console.Write("Input the string : ");
str = Console.ReadLine();
l = str.Length - 1;
Console.Write("The characters of the string in reverse are : \n");
while (l >= 0)
{
Console.Write("{0} ", str[l]);
l--;
}
Console.Write("\n\n");
}
}
Sample Output:
print individual characters of string in reverse order : ------------------------------------------------------ Input the string : ecruoser3w The characters of the string in reverse are : w 3 r e s o u r c e
Flowchart:
C# Sharp Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a program in C# Sharp to separate the individual characters from a string.
Next: Write a program in C# Sharp to count the total number of words in a string.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework