Calculate.cs 1002 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace ConsoleApp1
  7. {
  8. public class Calculate
  9. {
  10. public static double Sum(double x,double y)
  11. {
  12. return x + y;
  13. }
  14. public static double Subtraction(double x, double y)
  15. {
  16. return x - y;
  17. }
  18. public static double Multiplication(double x, double y)
  19. {
  20. return x * y;
  21. }
  22. public static double Division(double x, double y)
  23. {
  24. return x / y;
  25. }
  26. public static double Exponentiation(double x, double y)
  27. {
  28. if(y != 0)
  29. {
  30. double result = x;
  31. for (int i = 1; i < y; i++)
  32. {
  33. result = result * x;
  34. }
  35. return result;
  36. }
  37. else
  38. {
  39. return 1;
  40. }
  41. }
  42. }
  43. }