calculator using oops
using System;
namespace calcu
{
public class calculator
{
public void sum(int x, int y)
{
int z = x + y;
Console.WriteLine(z);
}
public void sub(int x, int y)
{
int z = x - y;
Console.WriteLine(z);
}
public void sqrt(double x)
{
double z = Math.Sqrt(x);
Console.WriteLine(z);
}
public void mul(int x, int y)
{
int z = x * y;
Console.WriteLine(z);
}
public void div(int x, int y)
{
int z = x / y;
Console.WriteLine(z);
}
public void mod(int x, int y)
{
int z = x % y;
Console.WriteLine(z);
}
public static void Main()
{
//library class instance
calculator cal = new calculator();
//method populate
cal.sum(2, 5);
cal.sqrt(25);
cal.sub(5,2);
cal.mul(5,2);
cal.div(10,2);
cal.mod(11,2);
}
}
}
namespace calcu
{
public class calculator
{
public void sum(int x, int y)
{
int z = x + y;
Console.WriteLine(z);
}
public void sub(int x, int y)
{
int z = x - y;
Console.WriteLine(z);
}
public void sqrt(double x)
{
double z = Math.Sqrt(x);
Console.WriteLine(z);
}
public void mul(int x, int y)
{
int z = x * y;
Console.WriteLine(z);
}
public void div(int x, int y)
{
int z = x / y;
Console.WriteLine(z);
}
public void mod(int x, int y)
{
int z = x % y;
Console.WriteLine(z);
}
public static void Main()
{
//library class instance
calculator cal = new calculator();
//method populate
cal.sum(2, 5);
cal.sqrt(25);
cal.sub(5,2);
cal.mul(5,2);
cal.div(10,2);
cal.mod(11,2);
}
}
}
Comments
Post a Comment