Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public interface bookProblem260415morning {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int pages = Integer.parseInt(scan.nextLine());
- int campDays = Integer.parseInt(scan.nextLine());
- int readNormal = Integer.parseInt(scan.nextLine());
- if (campDays == 30 || readNormal == 0){
- System.out.println("never");
- return;
- }
- int readDays = 30 - campDays;
- int readPages = readDays * readNormal;
- int totalMonth = (int)Math.ceil(pages / readPages);
- int years = totalMonth / 12;
- int months = totalMonth % 12;
- System.out.printf("%d years %d months",years,months);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement