google.com, pub-8786015629279405, DIRECT, f08c47fec0942fa0 Write a program in java to accept the number of days and display the result after converting into number of years, number of months and the remaining number of day.

Write a program in java to accept the number of days and display the result after converting into number of years, number of months and the remaining number of day.

0
import java.io*;

public class days
{
public static void main ( )
{
int a=455;
int b,y,m,d;
y=a/365;
b=a%365;
m=b/30;
d=b%30;
System.out.println("The no. of years ="+y);
System.out.println("The no. of months ="+m);
System.out.println("The no. of days ="+d);
}
}

Expected output:

The no. of years=1
The no. of months=3
The no. of days=0


Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Thank you for your interest 😊

We will back shortly after reviewing...

Thank you for your interest 😊

We will back shortly after reviewing...

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top