21
1
using System;
2
3
public class Program
4
{
5
public static void Main()
6
{
7
8
//create class instance
9
Program p= new Program();
10
//call method using class instance created above
11
p.AddTwoNumber();
12
}
13
//void is return type, means it will not return anything
14
//public is acces type, means it can be accessed from anywhere in the program
15
public void AddTwoNumber()
16
{
17
int a=10, b=20;
18
int c= a+b;
19
Console.WriteLine("Sum ="+c);
20
}
21
}
Cached Result
10/1/2020 12:00:00 AM
1/1/1970 12:00:00 AM
1/1/0001 12:00:00 AM
18446681938112751616
1/1/1970 12:00:00 AM
1/1/0001 12:00:00 AM
18446681938112751616