fbinnzhivko

Compound interest

Mar 13th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         decimal PriceTV = int.Parse(Console.ReadLine());
  7.         int retarnYears = int.Parse(Console.ReadLine());
  8.         decimal bankInterest = decimal.Parse(Console.ReadLine());
  9.         decimal friendIterst = decimal.Parse(Console.ReadLine());
  10.  
  11.  
  12.         decimal dasd = 1 + bankInterest;
  13.         double bankLoan = (double)PriceTV * Math.Pow((double)dasd, retarnYears);
  14.         //Console.WriteLine(bankLoan);
  15.         double friandLoan = (double)PriceTV * (1 + (double)friendIterst);
  16.         //Console.WriteLine(friandLoan);
  17.  
  18.         if (bankLoan < friandLoan)
  19.         {
  20.             Console.WriteLine("{0:f2} Bank", bankLoan);
  21.         }
  22.         else
  23.         {
  24.             Console.WriteLine("{0:f2} Friend", friandLoan);
  25.         }
  26.  
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment