Press "Enter" to skip to content

C# Methods (Functions)

In object-oriented programming languages, functions are called methods. We do everything same with when we doing something with functions using with the methods. Briefly methods and functions are same thing. Purpose of using methods is instead of coding same thing again and again, we just define method and call that method. Methods make the coding easier.

Firstly, I will use already existing method. This method is Random method. Program will be about decide the heads or tails. I will make a loop and that loop go on 5 times. If number come 1 it will be heads. If it’s come 2 it will be tail. Code Sequence;

Screen Display;

Now, I will make a method which is about the taking the power of the number. Program will ask a number and power by the user and then will send the these information to the method and program will press the result on the screen. Code Sequence;

Screen Display;



  1. Thanks for the wonderful post

  2. It works quite well for me

Leave a Reply

Your email address will not be published. Required fields are marked *