Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

C# Sharp Exercises: Function: Learn, how to create a user define function

C# Sharp Function: Exercise-1 with Solution

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

Pictorial Presentation:

C# Sharp Exercises: Function: Learn, how to create a user define function

Sample Solution:

C# Sharp Code:

using System;
class funcexer1
{
    public static void welcome() 
    {
        Console.WriteLine("Welcome Friends!");
    }
 
    public static void HaveAnice()
    {
        Console.WriteLine("Have a nice day!");
    }
 
    public static void Main()
    {
    Console.Write("\n\nSee, how to create an user define function :\n");
    Console.Write("------------------------------------------------\n"); 	
        welcome();
        HaveAnice();
		Console.Write("\n");
    }
}

Sample Output:

See, how to create an user define function :                                                                  
------------------------------------------------                                                              
Welcome Friends!                                                                                              
Have a nice day!

Flowchart :

Flowchart: C# Sharp Exercises - Learn, how to create a user define function

C# Sharp Code Editor:

Improve this sample solution and post your code through Disqus

Previous: C# Sharp programming exercises Function with Solution.
Next: Write a program in C# Sharp to create a user define function with parameters.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.