Advertisement
Atanasov_88

Book Problem

Jul 8th, 2015
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2.  
  3.     class Petar_sGame
  4.     {
  5.         static void Main()
  6.         {
  7.             double numberPages = double.Parse(Console.ReadLine());
  8.             int campingDays = int.Parse(Console.ReadLine());
  9.             int pagesPerDay = int.Parse(Console.ReadLine());
  10.  
  11.             int readingDays = 30 - campingDays; //dni chete
  12.             int MonthPages = readingDays * pagesPerDay; //kolko stranici za 1 mesec
  13.  
  14.             if (readingDays == 0)
  15.             {
  16.                 Console.WriteLine("never");
  17.             }
  18.  
  19.             else
  20.             {
  21.                 int totalReading = (int)Math.Ceiling(numberPages / MonthPages);
  22.  
  23.                 int years = totalReading / 12;
  24.  
  25.                 int months = totalReading % 12;
  26.                    
  27.                 Console.WriteLine("{0} years {1} months", years, months);
  28.                
  29.             }
  30.            
  31.            
  32.  
  33.            
  34.  
  35.         }
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement