Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class CompoundInterest
- {
- static void Main()
- {
- double tvPrice = double.Parse(Console.ReadLine());
- int bankYears = int.Parse(Console.ReadLine());
- double bankInterest = double.Parse(Console.ReadLine());
- double friendInterest = double.Parse(Console.ReadLine());
- double bankLoan = tvPrice * Math.Pow((1 + bankInterest),bankYears);
- double friendLoan = tvPrice * (1 + friendInterest);
- if (bankLoan < friendLoan)
- {
- Console.WriteLine("{0:F2} Bank",bankLoan);
- }
- else
- {
- Console.WriteLine("{0:F2} Friend",friendLoan);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment