C# Program for Character to ASCII Conversion

Character to Ascii conversion

C# program to convert a given character to its corresponding ASCII value has been shown here. The algorithm, time complexity and pseudocode of the program can be found here. Find here the flowchart of the problem.






1. C# Program & output for Character to ASCII Conversion

Code has been copied
/*********************************************
           alphabetacoder.com
 C# proram for character to ASCII conversion
*********************************************/

using System;

namespace Ascii {
    class Program {
        static void Main(string[] args) {
            //declare and initialize character variable
            char c = 'A';

            // convert to ASCII
            int value = Convert.ToInt32(c);

            // display result
            Console.WriteLine("Ascii value of " + c + " is " + value);

            // wait for user to press any key
            Console.ReadKey();
        }
    }
}

Output


Ascii value of A is 65