SHARE
TWEET

Untitled

a guest Sep 1st, 2016 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.Back_To_The_Past
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var money = double.Parse(Console.ReadLine());
  14.             var year = int.Parse(Console.ReadLine());
  15.             var age = 18;
  16.             for (int i = 1800; i <= year; i++)
  17.             {
  18.                 if (i % 2 == 0) money -= 12000;
  19.                 else money -= (12000 + 50 * age);
  20.                 age++;
  21.             }
  22.             if (money >= 0) Console.WriteLine("Yes! He will live a carefree life and will have {0:f2} dollars left.", money);
  23.             else Console.WriteLine("He will need {0:f2} dollars to survive.",Math.Abs(money));
  24.         }
  25.     }
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top