import java.io.*;
public class konversi_waktu2 {
public static void main(String[] args) throws IOException
{
int jam=0, menit=0,detik=0;
int x=0;
BufferedReader stdin=
new BufferedReader (new InputStreamReader (System.in));
System.out.println("PROGRAM KONVERSI WAKTU");
System.out.println("======================\n");
System.out.print("Masukkan Jumlah Detik : ");
int jumlah = Integer.parseInt(stdin.readLine());
if (jumlah < 3600)
{
jam=0;
menit=jumlah/60;
detik=jumlah%60;
}
else if (jumlah == 3600)
jam=1;
else if (jumlah >= 3600)
{
if (jumlah <= 3660)
{
jam=1;
detik=jumlah-3600;
}
else
{
for (int i=jumlah; i>60 ; i/=60)
{
jam=i;
jam=jam/60;
menit=i%60;
detik=jumlah-((jam*3600)+(menit*60));
}
}
}
System.out.print("Hasil => " + jam + " Jam "+menit+" menit "+detik+" detik ");
}
}
Subscribe to:
Post Comments (Atom)






1 comments:
mau contoh program c++ yang lain kunjungi aja http://agussugianta00901343.blogspot.com
http://sugikboy.blogspot.com
Post a Comment