Write a Program to convert number of days into month

									

Object:-Write a Program to convert number of days into month.

class Days
{
    public static void main(String…s)
    {
      int n,m,d;
      System.out.println(“Enter the value”);
      n=Integer.parseInt(s[0]);
      m=n/30;
      d=n%30;
      System.out.println(n+” days“+” = “+m+” months “+”and “+d+” days”);
     }
}

Output

Enter the value
69
69 days=2 months and 9 days
 

Explanation

m=n/30,Here we divide the total number of days with number of days in a month

n=n%30,Here we do the mode of total number of days with 30,so that we can find out the days.