i am a beginner of java..please help me... anyone Please help me to do this anyone..
Answers
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 :) )