Найти сумму вклада за год - C#
Формулировка задачи:
В банк положен вклад в размере n, каждый месяц его размер увеличивается на 2%. Найти сумму вклада за год.
Решение задачи: «Найти сумму вклада за год»
textual
Листинг программы
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
namespace TestSharp
{
class Program
{
static void Main(string[] args)
{
const int month = 12;
const int procent = 2;
int sum = 0;
int sumYear = 0;
int currentProcent = 0;
Console.WriteLine("Enter the sum would you invest in the bank: ");
sum = Int32.Parse(Console.ReadLine());
sumYear = sum;
currentProcent = sum * procent / 100;
for (int i = 0; i < month; i++)
{
sumYear += currentProcent;
}
Console.WriteLine("Sum after year: " + sumYear);
}
}
}