Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication83
- {
- class Program
- {
- static void Main(string[] args)
- {
- var x = double.Parse(Console.ReadLine());
- var godina = int.Parse(Console.ReadLine());
- int age = 18;
- for (int i = 1800; i<= godina; i++)
- {
- if (i % 2 == 0)
- {
- x-=12000;
- }
- else
- {
- x=x - (12000 + age * 50);
- }
- age++;
- }
- if (x>=0)
- {
- Console.WriteLine("Yes! He will live a carefree life and will have {0:0.00} dollars left.", x);
- }
- else if (x<0)
- {
- Console.WriteLine("He will need {0:0.00} dollars to survive.", Math.Abs(x));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment