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.
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.
Output:
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.
Using the ToUpper() method, we converted the string from lowercase to uppercase and then printed the modified string on the console screen.