Загрузка данных


// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

{
    Console.WriteLine("Введите начальную сумму вклада: ");
    double deposit = Convert.ToDouble(Console.ReadLine());

    Console.WriteLine("Введите количество месяцев: ");
    int months = Convert.ToInt32(Console.ReadLine());

    double monthsyRate = 0.07;
    double currentTotal = deposit;

    Console.WriteLine("\n ---");
    Console.WriteLine("Месяц | Начислено за месяц | Итоговая сумма вклада");
    Console.WriteLine("\n ---");

    for (int i = 1; i <= months; i++)
    {
        double interestForMonth = Math.Floor(currentTotal * monthsyRate * 100) / 100;
        currentTotal += interestForMonth;
        
        Console.WriteLine($"{i,5} | {interestForMonth,18:C2} | {currentTotal:C2}");
    }
    Console.WriteLine($"\nИтоговая сумма спустя {months} мес.: {currentTotal:C2}");
    Console.WriteLine($"Всего начислено процентов {(currentTotal - deposit):C2}");

}