-
-
Save unilecs/0b27091a6e10a5350134fd743a00f28f to your computer and use it in GitHub Desktop.
Задача: Кредитный калькулятор
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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