Write a program that inputs second and display in number of hours and minute.

 

public static void main(String[] args) {

Scanner n=new Scanner(System.in);

int h,m,s;

System.out.println(“Enter Seconds=”);

s= n.nextInt();

h=s/60*60;

s=s%60*60;

m=s/60;

s=s%60;

System.out.println(“hours are=”+h);

System.out.println(“munits are=”+m);

System.out.println(“seconds are=”+s);

}

}

Output

run:
Enter Seconds=
7424
hours are=7380
munits are=44
seconds are=0
BUILD SUCCESSFUL (total time: 3 seconds)

2 Comments on “Write a program that inputs second and display in number of hours and minute.”

Leave a Reply

Your email address will not be published. Required fields are marked *