Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace test123
- {
- class Program
- {
- static void Main(string[] args)
- {
- double total = double.Parse(Console.ReadLine());
- double outgo = double.Parse(Console.ReadLine());
- double mount = 0;
- double sum = 0;
- while(true)
- {
- if (sum >= total)
- {
- Console.WriteLine("You did it!");
- Console.WriteLine($"It took you {Math.Floor(mount / 12)} years {mount % 12} months");
- return;
- }
- if (sum < 0)
- {
- Console.WriteLine("It seems you have bankrupted...");
- Console.WriteLine($"You have worked {Math.Floor(mount / 12)} years {mount % 12} months");
- return;
- }
- double mountIncome = double.Parse(Console.ReadLine());
- sum += mountIncome - outgo;
- mount++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement