Introduction to methods in C#



   Introduction to methods in C#

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

namespace MYPROJECT.startup
{
    class Startupday1
    {
        static void Main()
        {
            Console.Write("sum is {0}\n", um("Piyush","jaiswal"));
            Console.Write("sum is {0}\n",um(15,55));
            Console.Write("sum is {0}\n",um(24.6, 24.4));
            Console.ReadKey();        }
        static int um(int x, int y)
        {
            int sum = x + y;
            return sum;
        }
        static double um(double x, double y)
        {
            double sum = x + y;
            return sum;
        }
        static string um(string x, string y)
        {
            string sum = x + y;
            return sum;
        }
    }

}

                                                                    OUTPUT


Comments

Popular posts from this blog

Input and output in C#

Printing Hello World in C#

Passing value without reference in C#