Social Icons

Tuesday, 11 February 2014

Java program to convert given number of days into months and days using command line

class Days
{
public static void main(String args[])
{

int n,m,d;
n=Integer.parseInt(args[0]);

m=n/30;
d=n%30;

System.out.println(n+" days"+" = "+m+" months "+"and "+d+" days");
}
}


                                                            Output

No comments:

Post a Comment