The Program in C# Program to Convert Given String into lowercase is given below:
using System;
namespace LowerCaseConversion
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello Codeauri Family, Enter the string below to convert them into lowercase: ");
Console.WriteLine("Well,enter a string here: ");
string inputString = Console.ReadLine();
string lowerCaseString = inputString.ToLower();
Console.WriteLine("Okay, the lowercase version of the string is: " + lowerCaseString);
}
}
}
Output:
Hello Codeauri Family, Enter the string below to convert them into lowercase:
Well,enter a string here: HAPPY
Okay, the lowercase version of the string is: happy
Pro-Tips💡
Here are the step by step execution of above program:
using System;
: This is a directive that allows the use of types and methods from theSystem
namespace in the program.namespace LowerCaseConversion
: Thenamespace
declaration defines a named space in which you can place your classes and other code. In this case, it is namedLowerCaseConversion
.class Program
: This declares a new class namedProgram
. TheMain
method, which is the entry point of the program, will be defined inside this class.static void Main(string[] args)
: This is theMain
method, which is the entry point of the program. It takes an array of strings as an argument, but in this case, it is not used. Thestatic
keyword makes the method a class method, meaning it can be called without creating an instance of the class. Thevoid
keyword indicates that the method does not return a value.Console.WriteLine("Enter a string: ");
: This writes the text “Enter a string: ” to the console.string inputString = Console.ReadLine();
: This reads a line of text from the console and stores it in theinputString
variable.string lowerCaseString = inputString.ToLower();
: This uses theToLower
method to convert theinputString
to lowercase and stores the result in thelowerCaseString
variable.Console.WriteLine("Lowercase version of the string: " + lowerCaseString);
: This writes the text “Lowercase version of the string: ” followed by the value of thelowerCaseString
variable to the console
Learn C-Sharp ↗
C-sharp covers every topic to learn about C-Sharp thoroughly.
Learn C Programming ↗
C-Programming covers every topic to learn about C-Sharp thoroughly.
Learn C++ Programming↗
C++ covers every topic to learn about C-Sharp thoroughly.