123456789101112131415161718192021222324252627282930 |
- using System;
- namespace Calculator
- {
- public class Calculator
- {
- public float Add(int a, int b) => a + b;
- public float Subtract(int a, int b) => a - b;
- public float Multiply(int a, int b) => a * b;
- public float Divide(int a, int b)
- {
- if (b == 0)
- throw new ArgumentException("Division by zero");
- return a / (float)b;
- }
- public float Power(int a, int b)
- {
- int c = 1;
- for (int i = 0; i < b; i++)
- {
- c *= a;
- }
- return c;
- }
- }
- }
|