Advertisement
kallyy7

Untitled

Feb 28th, 2018
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.58 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.Salary
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double salary = double.Parse(Console.ReadLine());
  14.             int workTime = int.Parse(Console.ReadLine());
  15.             string syndicate = Console.ReadLine();
  16.             int moreYears = 0;
  17.  
  18.             for (int i = 1; i <= 1000; i++)
  19.             {
  20.                 salary += salary * 0.06;
  21.                 if (i % 5 == 0 && i != 1)
  22.                 {
  23.                     salary += 100;
  24.                     if (i % 10 == 0)
  25.                     {
  26.                         salary += 100;
  27.                     }
  28.                 }
  29.                 else if (syndicate == "Yes" && i % 5 != 0)
  30.                 {
  31.                     salary *= 0.99;
  32.                 }
  33.                 if (salary >= 5000 && i <= workTime)
  34.                 {
  35.                     Console.WriteLine($"Current salary: 5000.00");
  36.                     Console.WriteLine("0 more years to max salary.");
  37.                     return;
  38.                 }
  39.                 if (i == workTime)
  40.                 {
  41.                     Console.WriteLine($"Current salary: {salary:F2}");
  42.                 }
  43.                 if (salary >= 5000)
  44.                 {
  45.                     moreYears = (i - 1) - workTime;
  46.                     Console.WriteLine($"{moreYears} more years to max salary.");
  47.                     return;
  48.                 }                              
  49.             }
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement