How To Make A Simple Console Application In C#

this is a simple program to separate 6 digits from input, first you create string and name it (shim)  and you prompt the user to enter the number using console.write(); then you assign the user to input shim using the console.readline function so on you display each display/character using writeline , in this the argument comes after the comma in this argument

Console.WriteLine("First digit: {0}", shim.Substring(0,1));
shim.Substring(0,1) 

shim.substring(0,1) , when you use susbstring its going to read the string which is , the user input

console.readkey(); will keep the application awake

lets make the application , create a new project and select console application and name it whatever you want , add the codes below
using System;

namespace simple_console_application

{
        class Program

        {
                      static void Main(string[] args)

                {
                        string shim = "";

                        Console.Write("Enter a 6 digit Number: ");

                        shim = Console.ReadLine();

                        Console.WriteLine("First digit: {0}", shim.Substring(0,1));

                        Console.WriteLine("Second digit: {0}", shim.Substring(1, 1));

                        Console.WriteLine("Third digit: {0}", shim.Substring(2,1));

                        Console.WriteLine("Fourth digit: {0}", shim.Substring(3,1));

                        Console.WriteLine("Fifth digit: {0}", shim.Substring(4,1));

                        Console.WriteLine("Sixth digit: {0}", shim.Substring(5, 1));

                        Console.ReadKey();
                }

        }
}
now debug and see how it works , enjoy

Post a Comment