Advertisement
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 Exams_26AprilMorning
- {
- class ReadBook
- {
- static void Main(string[] args)
- {
- int pagesOfBook = int.Parse(Console.ReadLine());
- int campingDays = int.Parse(Console.ReadLine());
- int pagesReadStefan = int.Parse(Console.ReadLine());
- int month = 30;
- int year = 12;
- double leftReadDays = month - campingDays;
- double readPerMonth = leftReadDays * pagesReadStefan;
- double needTimeForReading = pagesOfBook / readPerMonth;
- double inYears = needTimeForReading / year;
- if (campingDays == month || pagesReadStefan == 0)
- {
- Console.WriteLine("never");
- }
- else if (needTimeForReading < 12)
- {
- Console.WriteLine($"0 years {Math.Ceiling(needTimeForReading)} months");
- }
- else
- {
- double leftMonths = needTimeForReading % 12;
- Console.WriteLine($"{(int)inYears} years {Math.Ceiling(leftMonths)} months");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement