Home »
.Net »
C# Programs
C# program to convert a string from lowercase to uppercase
Here, we are going to learn how to convert a string from lowercase to uppercase in C#?
Submitted by Nidhi, on October 10, 2020
Problem statement
Here we read a string from the keyboard and then convert the string from lowercase to uppercase.
C# program to convert a string from lowercase to uppercase
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.
C# Basic Programs »