Home for the Programmer, Webmaster and Bloggers

27 November 2018

Coding Even Numbers In C#.Net

Image result for c# image

This might be difficult for some people don't panic, i first found this difficult when i was starting coding then as beginner. Mostly what you need is to follow the steps below:


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

namespace Even
{
    class Program
    {
        static void Main(string[] args)
        {
            //THis Part displays the message "supply first value" to the user.
            Console.WriteLine("Supply first value");
            /* This part accept the value to be supplied by the user
          and also the keyword int.parse perform an operation called casting
          on the value supplied by the user coz the compiler will automatically take any
          input as a string.
           */
            int first = int.Parse(Console.ReadLine());
            //THis Part displays the message "supply first value" to the user.
            Console.WriteLine("Supply second value");
            /* This part accept the value to be supplied by the user
         and also the keyword int.parse perform an operation called casting
         on the value supplied by the user coz the compiler will automatically take any
         input as a string.
          */
            int second = int.Parse(Console.ReadLine());
            // This part displays the result of the addition of variable first and second
            Console.WriteLine("Answer=" +  ( first - second));
            Console.ReadKey();
        }

    }

No comments:

Post a Comment