Friday, 29 August 2014

Ascii Character in C#

using System;
class Program
{
    static void Main()
    {
        //converting char to int
        int i;
        Console.WriteLine("Enter any Number:");
        i = int.Parse(Console.ReadLine());
        char c = Convert.ToChar(i);
        Console.WriteLine(c);
        Console.ReadLine();


        //converting int to char
        char k;
        Console.WriteLine("Enter any Char:");
        k = char.Parse(Console.ReadLine());
        int m = Convert.ToInt32(k);
        Console.WriteLine(m);
        Console.ReadLine();

    }


}

How to Convert Char to Int
output


No comments:

Post a Comment