Q:

Write a program in C# Sharp to create a user define function with parameters

0

Write a program in C# Sharp to create a user define function with parameters. 
Test Data :
Please input a name : John
Expected Output :
Welcome friend John !
Have a nice day!

All Answers

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

using System;
public class funcexer2
{   
    public static void welcome(string name)
    {
        Console.WriteLine("Welcome friend " + name+" !");
    }
    public static void HaveAnice()
    {
        Console.WriteLine("Have a nice day!");
    }
    public static void Main(string[] args)
    {
	  Console.Write("\n\nSee, how to create an user define function with parameters :\n");
      Console.Write("----------------------------------------------------------------\n"); 
	  string str1;	
      Console.Write("Please input a name : ");
      str1 = Console.ReadLine();	  
      welcome(str1);
      HaveAnice();
    }
}

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

total answers (1)

Similar questions


need a help?


find thousands of online teachers now