/* #-------------------------- # Program Konversi waktu # Jam --> Menit --> Detik #-------------------------- Ket : a = Jam d = sisa b = menit e = detik c = detik(input) 1 Jam = 3600 Detik 1 Menit = 60 Detik */ #include<stdio.h> #include<conio.h> void main() { long int a,b,c,d,e; printf("------------------------\n"); printf("Program konversi waktu\n"); printf("------------------------\n"); printf("Input waktu(Detik) = ");scanf("%ld",&c); a=c/3600; d=c%3600; b=d/60; e=d%60; printf("%ld",a);printf(" jam "); printf("%ld",b);printf(" Menit "); printf("%ld",e);printf(" Detik "); getch(); }
Program konversi waktu Part II
/* #------------------------------------ # Program konversi waktu Part II # Jam --> menit --> Detik --> Detik #------------------------------------ Ket : a = jam (input) b = menit (input) j = jam (output) m = menit (output) e = sisa (input) hasil = hasil (output) */ #include<stdio.h> #include<conio.h> #include<iostream.h> void main() { long int a,b,e,j,m,hasil; printf("======================================\n"); printf("Program konversi waktu Part II\n"); printf("======================================\n"); printf("Input Jam : " );scanf("%ld",&a); printf("Input Menit : " );scanf("%ld",&b); printf("Input Detik : " );scanf("%ld",&e); j=a*3600; m=b*60; hasil=j+m+e; printf("\nHasilnya = %ld",hasil);printf(" Detik "); printf("\n======================================"); getch(); }