Skip to content

Instantly share code, notes, and snippets.

@unilecs
Created March 10, 2019 23:23
Show Gist options
  • Save unilecs/0b27091a6e10a5350134fd743a00f28f to your computer and use it in GitHub Desktop.
Save unilecs/0b27091a6e10a5350134fd743a00f28f to your computer and use it in GitHub Desktop.
Задача: Кредитный калькулятор
using System;
public class Program
{
public static void Main()
{
Console.WriteLine("UniLecs");
CreditCalculator(50000, 12, 22);
}
private static void CreditCalculator(int s, int months, double r)
{
double i = r / 100 / 12; // получаем ежемесячную процентную ставку
double p = s * (i + i / (Math.Pow(1 + i, months) - 1));
double total = p * months;
Console.WriteLine(string.Format("Ежемесячная выплата = {0} руб.", Math.Round(p, 2)));
Console.WriteLine(string.Format("Суммарная выплата по кредиту = {0} руб.", Math.Round(total, 2)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment