Computer Science, asked by dmr990365, 6 months ago

Write a program in Java to accept the 5 digits day value (using Function argument

of main ( ) method) & convert the day value in year, month week and day form.

Display the result with proper message.​

Answers

Answered by vaishnavi141347
5

Answer:

import java.util.Scanner;

public class Year_Week_Day  

{

   public static void main(String args[])

   {

       int m, year, week, day;

       Scanner s = new Scanner(System.in);

       System.out.print("Enter the number of days:");

       m = s.nextInt();

       year = m / 365;

       m = m % 365;

       System.out.println("No. of years:"+year);

       week = m / 7;

       m = m % 7;

       System.out.println("No. of weeks:"+week);

       day = m;

       System.out.println("No. of days:"+day);

   }

}

Output:

$ javac Year_Week_Day.java

$ java Year_Week_Day

 

Enter the number of days:756

No. of years:2

No. of weeks:3

No. of days:5

Answered by adi24032007
1

Answer:

sorry for bad handwriting

this program is checked by my computer teacher.

thank you have a great day.

Attachments:
Similar questions