KlimentHristov

01.CompoundInterest

Nov 11th, 2015
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using System;
  2.     class CompoundInterest
  3.     {
  4.         static void Main()
  5.         {
  6.             double tvPrice = double.Parse(Console.ReadLine());
  7.             int bankYears = int.Parse(Console.ReadLine());
  8.             double bankInterest = double.Parse(Console.ReadLine());
  9.             double friendInterest = double.Parse(Console.ReadLine());
  10.            
  11.  
  12.             double bankLoan = tvPrice * Math.Pow((1 + bankInterest),bankYears);
  13.             double friendLoan = tvPrice * (1 + friendInterest);
  14.  
  15.             if (bankLoan < friendLoan)
  16.             {
  17.                 Console.WriteLine("{0:F2} Bank",bankLoan);
  18.             }
  19.             else
  20.             {
  21.                 Console.WriteLine("{0:F2} Friend",friendLoan);
  22.             }
  23.         }
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment