Write a program in java to enter number of days, and calculate
number of years, number of months and number of days in the
given days.
Example:- let there are 500 days as input then the output will be
Number of years: 1
Number of months: 4
Number of days: 15
Answers
Answered by
0
Answer:
import java.util.Scanner;
public class Year_Week_Day
{
public static void main(String args[])
{
int m, year, week, day;
Scanner s = new Scanner(System.in);
System.out.print("Enter the number of days:");
m = s.nextInt();
year = m / 365;
m = m % 365;
System.out.println("No. of years:"+year);
week = m / 7;
m = m % 7;
System.out.println("No. of weeks:"+week);
day = m;
System.out.println("No. of days:"+day);
}
}
Similar questions