import java.util.*;
class days
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int n,y,r,m,d;
System.out.println("Enter the no of days");
n=sc.nextInt();
y=n/365;
r=n%365;
m=r/30;
d=r%30;
System.out.println("Years "+y+" Months "+m+" Days "+d);
}
}
Output:
Enter the no of days
700
Years 1 Months 11 Days 5
class days
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int n,y,r,m,d;
System.out.println("Enter the no of days");
n=sc.nextInt();
y=n/365;
r=n%365;
m=r/30;
d=r%30;
System.out.println("Years "+y+" Months "+m+" Days "+d);
}
}
Output:
Enter the no of days
700
Years 1 Months 11 Days 5