using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    public class Calculation
    {
        /// <summary>
        /// Сумма 2 чисел
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public static double Sum(double x, double y) {
            return x + y;
        }
        /// <summary>
        /// Разность 2 чисел
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public static double Difference(double x, double y) {   
            return Math.Round(x - y,2);
        }
        /// <summary>
        /// Произведение 2х чисел
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public static double Increase(double x, double y) {
            return Math.Round(x * y, 2);
        }
        /// <summary>
        /// Частное 2х чисел
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public static double Division(double x, double y) {
            double result;
            if(y==0){return 0;}
            else {
                result = Math.Round(x / y, 3);
                return result;            
            }          
        }
        /// <summary>
        /// Степень 2 чисел.2 число является степенью 1го числа.
        /// </summary>
        /// <param name="x">основание</param>
        /// <param name="y">степень</param>
        /// <returns></returns>
        public static int Extent(int x, int y)
        {
            int result=x;
            if (y == 0) { return 1; }
            else
            {
                while (y > 1)
                {
                    result *= x;
                    y--;
                }
                return result;
            }            
        }
    }
}
