Q:

Write a C# program to create a user define function with parameter

0

Write a C# program to create a user define function with parameter

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..

using System;
 
public class functionexcercise
{
    public static void welcome(string name)
    {
        Console.WriteLine("Welcome " + name );
    }
    public static void HaveAnice()
    {
        Console.WriteLine("Have a nice day");
    }
    public static void Main(string[] args)
    {
        string str1;
        Console.Write("Please Enter a name : ");
        str1 = Console.ReadLine();
        welcome(str1);
        HaveAnice();
 
        Console.ReadLine();
    }
}

Result:

Please Enter a name : Rohit

Welcome Rohit

Have a nice day

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a C# program to add two numbers using functi... >>