Computer Science, asked by arunangshu2003, 1 year ago

i am a beginner of java..please help me... anyone Please help me to do this anyone..​

Attachments:

Anonymous: Yaa bro I can do
arunangshu2003: please do it fo4 me
arunangshu2003: for*
rakeshchennupati143: check out i used Scanner() class

Answers

Answered by rakeshchennupati143
1

Program 1:

import java.io.*;

import java.util.*;

public class Main{

     public static void main(String[] args) {

           Scanner sc = new Scanner(System.in);

           System.out.println("Enter days count : ");

           int days = sc.nextInt();

           System.out.println("years = "+(days/365));

           System.out.println("months = "+((days%365)/30));

           System.out.println("days = "+((days%365)%30));

     }

}

Output

Enter days count :

2525452

years = 6919

months = 0

days = 17

Program 2:

import java.io.*;

import java.util.*;

public class Main{

     public static void main(String[] args) {

           Scanner sc = new Scanner(System.in);

           System.out.println("Enter time in seconds: ");

           int time = sc.nextInt();

           System.out.println("days = "+(time/86400));

           System.out.println("hours = "+((time%86400))/3600);

           System.out.println("minutes = "+(((time%86400)%3600)/60));

     }

}

Output:

Enter time in seconds:

313800

days = 3

hours = 15

minutes = 10

---Hope you got what you wanted ( mark as brainliest if you like my way of answering :) )

Similar questions