Advertisement
Guest User

Untitled

a guest
Jul 26th, 2015
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. class Program
  5. {
  6.     static void Main()
  7.     {
  8.         double p = double.Parse(Console.ReadLine());
  9.         int n = int.Parse(Console.ReadLine());
  10.         double i = double.Parse(Console.ReadLine());
  11.         double f = double.Parse(Console.ReadLine());
  12.  
  13.         double futureValuBank = p * Math.Pow((1 + i), n);
  14.         double futureValueFriend = p * (1 + f);
  15.  
  16.         double money = Math.Min(futureValuBank, futureValueFriend);
  17.         string bankOrFriend = futureValuBank < futureValueFriend ? "Bank" : "Friend";
  18.        
  19.         Console.WriteLine("{0} {1}", money, bankOrFriend);
  20.  
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement