Sunday, 26 August 2012

Java Program to convert given no. of days into months and days


 Java Program to convert given no. of days into months and days.
  (Assuming each month is of 30 days)

Class DayMonth{
      public static void main(String args[]){
      int number = Integer.parseInt(args[0]);
      int days = number%30;
      int month = number/30;
      System.out.println(number+" days = "+month+" Month and "+days+" days");
   }
}

No comments:

Post a Comment

Post a Comment