Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Example
- {
- public static void Main ()
- {
- double ownMoney = double.Parse (Console.ReadLine ());
- int year = int.Parse (Console.ReadLine ());
- int age = 17;
- for (int i = year; i >= 1800; i--)
- {
- age++;
- if (i % 2 == 0)
- {
- ownMoney -= 12000;
- }
- else
- {
- ownMoney -= 12000 + (50 * age);
- }
- }
- if (ownMoney >= 0)
- {
- Console.WriteLine ("Yes! He will live a carefree life and will have {0:F2} dollars left.", Math.Abs (ownMoney));
- }
- else
- {
- Console.WriteLine ("He will need {0:F2} dollars to survive.", Math.Abs (ownMoney));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement