Q:

Write a C# Sharp program to get the ASCII value of a given character

0

Write a C# Sharp program to get the ASCII value of a given character

Sample Output:

Ascii value of 1 is: 49
Ascii value of A is: 65
Ascii value of a is: 97
Ascii value of # is: 35

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
using System.Linq;
namespace exercises
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Ascii value of 1 is: "+test('1'));
            Console.WriteLine("Ascii value of A is: " + test('A'));
            Console.WriteLine("Ascii value of a is: " + test('a'));
            Console.WriteLine("Ascii value of # is: " + test('#'));

        }
        public static int test(char ch)
        {
            return (int)ch;
        }
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now