Advertisement
kallyy7

Untitled

Feb 28th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 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 _04.Rate
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double S = double.Parse(Console.ReadLine());
  14.             int months = int.Parse(Console.ReadLine());
  15.             double simple = S;
  16.             double complex = S;
  17.  
  18.             for (int a = 1; a <= months; a++)
  19.             {
  20.                 simple += S * 0.03;
  21.             }
  22.             for (int b = 1; b <= months; b++)
  23.             {
  24.                 complex += complex * 0.027;
  25.             }
  26.             Console.WriteLine($"Simple interest rate: {simple:F2} lv. ");
  27.             Console.WriteLine($"Complex interest rate: {complex:F2} lv.");
  28.             if (simple > complex)
  29.             {
  30.                 double win = simple - complex;
  31.                 Console.WriteLine($"Choose a simple interest rate. You will win {win:F2} lv.");
  32.             }
  33.             else
  34.             {
  35.                 double win = complex - simple;
  36.                 Console.WriteLine($"Choose a complex interest rate. You will win {win:F2} lv.");
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement