# Program to convert given number into month and days

In this program we will convert a given number into its equivalent months and days, For example, if take the number as 75 then we will get 2 months and 15 days.

**Step 1:** Get the number the from the user

**Step 2:** Convert the number into its equivalent months and days

**Step 3:** Display the month and day

class DayMonth{

public static void main(String args[]) // main method

{

int num, days, month;

num = Integer.parseInt(args[0]);

days = num % 30; // gives reminder

month = num / 30; // gives no of times it divide

System.out.println ( num+ “days = “ +month+ “ Month and “+days+” days);

}

}

Let see explanation of the program

num will take the integer value as the input

For example, let give the input value as 75

So now this input value of 75 should be converted into month and days

**days = num % 30; **

This % modulus operator is used here to get the remainder

Days = 75 % 30

75 will be divided by 30 then we will get the remainder as 15

So the days = 15

month = num / 30;

/ is the divide operator so it will give the no of times it is divided

**month = 75 / 30**

Here 75 is getting divided by 30 for two times so the answer is 2

month = 2

So the output of it will be

75 days = 2 Month and 15 days