Display Uppercase and Lowercase letters (Use of OR operator) :

This program displays uppercase and lowercase letters together. 
class Program

{
static void Main(string[] args)
{
char ch;
for(int i=0;i<26;i++)
{
ch = (char) (‘A’ + i);
Console.Write(ch);

ch = (char) (ch | 32);   //ch is now lowercase
Console.Write(ch+” “);
}
Console.Read();
}
}

 
OUTPUT
 
Now if we run this program then we can see this ,
 
 

Leave a Reply