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

Here we read a string from the keyboard and then convert the string from lowercase to uppercase.

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.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.