Playing with C#

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

namespace for_loop
{
    class Program
    {

        static void Main(string[] args)
        {
            
//            Display();
            int firstNumber = Convert.ToInt32(Console.ReadLine());
            int secondNumber = Convert.ToInt32(Console.ReadLine());

            int result = Add(firstNumber,secondNumber);
            Console.WriteLine(result);
            Console.ReadKey();
        }

       static int Add(int firstNumber, int secondNumber)
        {
            int result = firstNumber + secondNumber;
            return result;
        }

        static void Display()
        {
            Console.WriteLine("Hello World");
        }
    }
}

 

Clean Code:

using System;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            string takingInputFrom = Console.ReadLine();
            string greeting = "Good Morning" + takingInputFrom;
            Console.WriteLine(greeting);
            Console.ReadLine();
        }
    }
}

 

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.