Skip to main content

C#: Program #31 (Methods6)

using System;

namespace Methods6
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("The sum of 5.4+7.0 is:{0}",sum(5.4,7.0));
            Console.WriteLine("The sum of 5+7 is:{0}", sum(5, 7));

            Console.ReadKey();
        }
        static double sum(double a,double b)
        {
            return a + b;
        }
        static double sum(int a,int b)
        {
            return a + b;
        }
    }
}

Comments

Popular posts from this blog

C#: Program #15 (For Loop)

using System; namespace Loops {     class Program     {         static void Main(string[] args)         {                         object[] information = {"Gray", "14-Arid-4052", "Rawalpindi",21,3.80};             for (int i = 0; i < information.Length; i++)             {                 Console.WriteLine("The value of index {0} is {1}",i,information[i]);             }                 Console.ReadKey();         }     } }