Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

C# Sharp Exercises: Reverse a given string in uppercase

C# Sharp String: Exercise-45 with Solution

Write a C# Sharp program to reverse a given string in uppercase.

Sample Solution:-

C# Sharp Code:

using System;
using System.Linq;
namespace exercises
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Original string: php");
            Console.WriteLine("Said string in uppercase: " + test("php"));
            Console.WriteLine("Original string: java");
            Console.WriteLine("Said string in uppercase: " + test("java"));
            Console.WriteLine("Original string: abcd");
            Console.WriteLine("Said string in uppercase: " + test("abcd"));
        }
        public static string test(string text)
        {
            return new string(text.ToCharArray().Reverse().ToArray()).ToUpper();
        }
    }
}

Sample Output:

Original string: php
Said string in uppercase: PHP
Original string: java
Said string in uppercase: AVAJ
Original string: abcd
Said string in uppercase: DCBA

Flowchart :

Flowchart: C# Sharp Exercises - Reverse a given string in uppercase.

C# Sharp Code Editor:

Improve this sample solution and post your code through Disqus

Previous: Write a C# Sharp program to get the longest Palindromic substring from a given string.
Next: Write a C# Sharp program to remove duplicate characters from a given string.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.