Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- double p = double.Parse(Console.ReadLine());
- int n = int.Parse(Console.ReadLine());
- double i = double.Parse(Console.ReadLine());
- double f = double.Parse(Console.ReadLine());
- double futureValuBank = p * Math.Pow((1 + i), n);
- double futureValueFriend = p * (1 + f);
- double money = Math.Min(futureValuBank, futureValueFriend);
- string bankOrFriend = futureValuBank < futureValueFriend ? "Bank" : "Friend";
- Console.WriteLine("{0} {1}", money, bankOrFriend);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement