Q:

C# program to convert a string from lowercase to uppercase

belongs to collection: C# Basic Programs | String programs

0

C# program to convert a string from lowercase to uppercase

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

The source code to convert a string from lowercase to uppercase in a given string is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.

//C# program to convert a string from 
//lowercase to uppercase.

using System;

class Demo
{
    public static void Main()
    {
        string text;
        Console.WriteLine("Enter a string:");
        
        text = Console.ReadLine();
        text = text.ToUpper();

        Console.WriteLine("String in Uppercase : "+text);
    }
}

Output:

Enter a string:
www.includehelp.com
String in Uppercase : WWW.INCLUDEHELP.COM
Press any key to continue . . .

Explanation:

Here, we created a Demo class that contains the Main() method. The Main() method is the entry point of the program. Here we read a string from the keyboard.

text = text.ToUpper();

Using the ToUpper() method, we converted the string from lowercase to uppercase and then printed the modified string on the console screen.

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C# Basic Programs | String programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C# program to print the abbreviation of a given st... >>
<< C# program to find the occurrence of the specified...