Advertisement
a1m

Compound interest

a1m
Apr 29th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4.  
  5. class Program
  6. {
  7.     static void Main(string[] args)
  8.     {
  9.         double priceOfTv = double.Parse(Console.ReadLine());
  10.         double years = double.Parse(Console.ReadLine());
  11.         double bankRate = double.Parse(Console.ReadLine());
  12.         double friendRate = double.Parse(Console.ReadLine());
  13.         double bankLoan = priceOfTv * (Math.Pow((1+bankRate), years));
  14.         double friendLoan = priceOfTv * (1+friendRate);
  15.         if (friendLoan <= bankLoan)
  16.         {
  17.             Console.WriteLine("{0:F2} Friend", friendLoan); return;
  18.         }
  19.         else
  20.         {
  21.             Console.WriteLine("{0:F2} Bank",bankLoan);
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement