Time converting program in Java
import java.util.*;
public class TimeConvert
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
System.out.println("Enter the value of seconds: ");
int sec=s.nextInt();
int hr=sec/3600;
int min=(sec-hr*3600)/60;
sec=sec-(hr*3600+min*60);
System.out.println(hr+"hours"+" "+min+"minites"+" "+sec+"seconds");
}
}
Comments
Post a Comment