Home / Tag Archives: Minutes

Tag Archives: Minutes

Java Programs

seconds to hours and minutes

Write a java program to accept seconds as an input and convert into hours and minutes? import java.util.*; public class timeConvert { int sec=0,min=0,hr=0; int reminder=0; Scanner sr = new Scanner(System.in); public timeConvert(){ System.out.println(“Enter seconds to convert”); sec=sr.nextInt(); if(sec!=0){ min=sec/60; reminder=sec%60; sec=reminder; if(min>=60){ hr=min/60; min=min%60; } } System.out.println(hr+”Hours:”+min+”Minutes:”+sec+”Seconds”); } public …

Read More »