Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 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 BackToThePast
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             decimal ost = decimal.Parse(Console.ReadLine());
  14.             uint godina = uint.Parse(Console.ReadLine());
  15.             //while (godina<1801|| godina > 1900) {  godina = uint.Parse(Console.ReadLine()); }
  16.             uint count = 18u;
  17.             for (uint i = 1800; i<= godina; i++)
  18.             {              
  19.                 if (i % 2 == 0)
  20.                 {
  21.                     ost -= 12000;
  22.                 }
  23.                 else
  24.                 {                  
  25.                     ost -= (12000 + 50 * (decimal)count);
  26.                     //Console.WriteLine(count);
  27.                     //Console.WriteLine((decimal)count);
  28.                 }
  29.                 count++;
  30.             }
  31.             if (ost < 0)
  32.             {
  33.                 Console.WriteLine("He will need {0:F2} dollars to survive.", Math.Abs(ost));        
  34.             }
  35.             else
  36.             {
  37.                 Console.WriteLine("Yes! He will live a carefree life and will have {0:F2} dollars left.",ost);
  38.             }
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement