rss
Twitter Delicious Facebook Digg Stumbleupon Favorites

Saturday, October 8, 2011

A program to convert given numbers of days into months and days.


Input - 69
Output - 69 days = 2 Month and 9 days
class DaysToMonths{
      public static void main(String args[]){
      int num = Integer.parseInt(args[0]);
      int days = num%30;
      int month = num/30;
      System.out.println(num+" days = "+month+" Month and "+days+" days");
   }
}

0 comments:

Post a Comment

Powered by Blogger.