Friday, September 27, 2013

String to ASCII Convertion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ASCII2Number
{
    class Program
    {
        static void Main(string[] args)
        {
            string str;
            Console.WriteLine("Enter the String to convert ASCII:\t");
            str = Console.ReadLine();
            int length=0;

            foreach (char obj in str)
            {
                length++;
            }
            for (int i = 0; i < length; i++)
            {
                Console.Write(Convert.ToInt32(str[i])+" ");
            }
                Console.ReadLine();
        }
    }
}

Output

String to ASCII Convertion

No comments:

Post a Comment