In this article, I will be writing a C# Program to Print ASCII Values. I will explain the program outline and give the output of the C# program.
Program Outline
Using a do-while loop, create a program that prints all of the ASCII values and their equivalent characters. The ASCII values range between 10 and 255.
C# Program to print ASCII values
Here’s the C# Program to print ASCII values:
using System;
namespace ASCIIValues
{
class Program
{
static void Main(string[] args)
{
char c;
Console.WriteLine("Enter a character: ");
c = Convert.ToChar( Console.ReadLine());
Console.WriteLine("\nThe ASCII Value of " +c+" "+ Convert.ToInt32(c));
Console.ReadKey();
}
}
}
Output
Here’s the output of the C# Program to print ASCII values:
