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 PiggyBank
- {
- class PiggyBank
- {
- static void Main(string[] args)
- {
- double priceOfTheTank = double.Parse(Console.ReadLine());
- double partiesDays = double.Parse(Console.ReadLine());
- double normalDays = 30 - partiesDays;
- double savings = (normalDays * 2) - (partiesDays * 5);
- double neededMonts = priceOfTheTank / savings;
- double years = neededMonts / 12;
- double monts = neededMonts % 12;
- if (monts < 0)
- {
- Console.WriteLine("never");
- }
- else
- {
- Console.WriteLine("{0} years, {1} months",Math.Floor(years) ,Math.Ceiling((double)monts));
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment