A function or method is basically a block of statements that perform a specific task. For example, you are building an application in C# programming language and in one of your program, you need to perform the same task more than once. In such case, you have 2 options:
A) Use the same set of statements every time you want to perform the task
B) Create a function/Method to perform that task, and just call it when you need to perform that task.
Using option (B) is always a good practice and a good programmer always uses functions while writing codes in C# or any other programming language.
- Write a C# program to create a user define function with parameter
- Write a C# program to add two numbers using function
- Write a C# program to create a function to input a string and count number of spaces are in the string
- Write a C# program to find even or odd number using function
- Write a C# program to create a function to calculate the sum of the individual digits of a given number
- Write a C# program to create a function to check whether a number is prime or not
- Write a C# program to create a function to display the n number Fibonacci sequence
- Write a C# program to create a function to swap the values of two integer numbers
- Write a C# program to create a recursive function to find the factorial of a given number
- Write a C# program to Print Binary Equivalent of an Integer using Recursion