Output character with for loop - CSharp Language Basics

CSharp examples for Language Basics:char

Description

Output character with for loop

Demo Code


using System;//from w ww  .  j a  v a 2s  .c o m

class chars
{
   public static void Main()
   {
       int ctr;
       char ch;

       Console.WriteLine("\nNumber   Value\n");

       for( ctr = 97; ctr <= 122; ctr = ctr + 1)
       {
           ch = (char) ctr;
           Console.WriteLine( "{0} is {1}", ctr, ch);
       }
   }
}

Result


Related Tutorials