Advertisement
WindFell

Rate

Apr 4th, 2018
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Rate
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double sum = double.Parse(Console.ReadLine());
  14.             int months = int.Parse(Console.ReadLine());
  15.             double simpleTotal = sum;
  16.             double complexTotal = sum;
  17.  
  18.             for (int i = 0; i < months; i++)
  19.             {
  20.                 simpleTotal += 0.03 * sum;
  21.                 complexTotal *= 1.027;
  22.             }
  23.  
  24.             Console.WriteLine($"Simple interest rate: {simpleTotal:F2} lv.");
  25.             Console.WriteLine($"Complex interest rate: {complexTotal:F2} lv.");
  26.  
  27.             if (simpleTotal > complexTotal)
  28.             {
  29.                 Console.WriteLine($"Choose a simple interest rate. You will win {(simpleTotal - complexTotal):F2} lv.");
  30.             }
  31.             else
  32.             {
  33.                 Console.WriteLine($"Choose a complex interest rate. You will win {(complexTotal - simpleTotal):F2} lv.");
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement