Advertisement
iliqnvidenov

Untitled

Jan 28th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5.  
  6.  
  7. class Program
  8. {
  9.     static void Main()
  10.     {
  11.         int tankPrice = int.Parse(Console.ReadLine());
  12.         int parties = int.Parse(Console.ReadLine());
  13.         int monthCash = 60 - (parties * 2);
  14.         int cashForParties = parties * 5;
  15.         double months =(double)tankPrice / (monthCash - cashForParties);
  16.         int monthsInt =(int)Math.Ceiling(months);
  17.         if (parties > 8)
  18.         {
  19.             Console.WriteLine("never");
  20.         }
  21.         else
  22.         {
  23.             int years = monthsInt / 12;
  24.             months = monthsInt % 12;
  25.             Console.WriteLine("{0} years, {1} months", years, months);
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement