stefan1919

Book Problem

Aug 25th, 2015
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication4
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             long pageCount = long.Parse(Console.ReadLine());
  14.             int campingDays = int.Parse(Console.ReadLine());
  15.             int normalDay = int.Parse(Console.ReadLine());
  16.             double months1 = 0;
  17.            
  18.            
  19.            
  20.                 int years = 0;
  21.                 double months = 0;
  22.                 long divider = (30 - campingDays) * normalDay;
  23.                 if (divider <= 0 || campingDays >= 30)
  24.                 {
  25.                     Console.WriteLine("never");
  26.                 }
  27.                 else
  28.                 {
  29.                     months = Math.Ceiling(pageCount / (double)divider);
  30.                     years = (int) (months / 12);
  31.                     months = months % 12;
  32.                     Console.WriteLine("{0} years {1} months", years, (int)months);
  33.                     }
  34.  
  35.  
  36.                    
  37.                
  38.                
  39.            
  40.            
  41.            
  42.            
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment