public static void main() { CalCulator sq = new CalCulator(); Console.WriteLine(sq.Add(3, 5)); Console.WriteLine(sq.Multiply(3, 5)); Console.WriteLine(sq.Subtract(5, 3)); Console.WriteLine(sq.Division(5, 3)); Console.WriteLine(sq.Modulus(5, 3)); Console.ReadKey(); }
static void Calculation() { Console.Write("Enter your number: "); double number1 = Convert.ToDouble(Console.ReadLine()); Console.Write("Enter the operator: "); string Operator = Console.ReadLine(); if (Operator == "sq") { AdvancedCalc calculateme = new AdvancedCalc(); Console.WriteLine(calculateme.Square(number1)); } else { Console.Write("Enter your second number: "); double number2 = Convert.ToDouble(Console.ReadLine()); CalCulator calculate = new CalCulator(); if (Operator == "+") { Console.WriteLine(calculate.Add(number1, number2)); } else if (Operator == "-") { Console.WriteLine(calculate.Subtract(number1, number2)); } else if (Operator == "*") { Console.WriteLine(calculate.Multiply(number1, number2)); } else if (Operator == "/") { Console.WriteLine(calculate.Division(number1, number2)); } else { Console.WriteLine("Invalid operator"); } } }