INPUT:
class calculator
{
double sum(double n1, double n2)
{
return n1 + n2;
}
double
subtract(double n1, double n2)
{
return n1 - n2;
}
double multiply(double n1, double
n2)
{
return n1 * n2;
}
double division(double n1, double
n2)
{
return n1 / n2;
}
static void Main(string[] args)
{
calculator c = new
calculator();
double input1, input2;
Console.WriteLine("enter
first no");
input1 = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("enter
second no");
input2 = Convert.ToDouble(Console.ReadLine());
double x = c.sum(input1, input2);
double y = c.multiply(input1, input2);
double z = c.division(input1, input2);
double w = c.subtract(input1, input2);
Console.WriteLine("subtraction {0}",w);
Console.WriteLine("sum {0}", x);
Console.WriteLine("multiply {0}", y);
Console.WriteLine("division {0}", z);
}
}
}
No comments:
Post a Comment