using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace A_B
{
class Add
{
int a, b;
public Add()
{
Console.WriteLine("Enter A value=");
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter B value=");
b = Convert.ToInt32(Console.ReadLine());
}
public Add(int a, int b)
{
this.a = a;
this.b = b;
}
public int GetSum()
{
return a + b;
}
}
class myclass
{
static void Main(string[] args)
{
Add obj1 = new Add();
int sum = obj1.GetSum();
Console.WriteLine("Sum of A+B=" + sum);
Console.ReadKey();
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace A_B
{
class Add
{
int a, b;
public Add()
{
Console.WriteLine("Enter A value=");
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter B value=");
b = Convert.ToInt32(Console.ReadLine());
}
public Add(int a, int b)
{
this.a = a;
this.b = b;
}
public int GetSum()
{
return a + b;
}
}
class myclass
{
static void Main(string[] args)
{
Add obj1 = new Add();
int sum = obj1.GetSum();
Console.WriteLine("Sum of A+B=" + sum);
Console.ReadKey();
}
}
}
Comments
Post a Comment