Time Conversion Program Using Turbo Pascal
Hello guys, this post we will learn a little about time. Yapp we will learn to convert this type of time using Turbo Pascal software. maybe this tutorial has a lot to discuss it, but it's okay we review again as can be used as a reference for friends who are studying.
Well, just go to Turbo Pascal software and create a new file. then enter the following code
program timeconversion;
uses crt;
var
hour,minute,second,sisa,nmr:integer;
ask:char;
label top;
begin
top:
clrscr;
writeln('Please Select Type Of Time To Convert');
writeln('===========================================');
writeln('1. Hour');
writeln('2. Minute');
writeln('3. Second');
writeln;
write('Input Number = ');readln(nmr);
if nmr = 1 then
begin
write('Enter Hour Amount = ');readln(hour);
writeln;
minute:=hour*60;
second:=minute*60;
writeln(minute,' Minute');
writeln(second, ' Second');
end
else if nmr = 2 then
begin
write('Enter Minute Amount = ');readln(minute);
writeln;
hour:=minute div 60;
sisa:=minute mod 60;
second:=minute*60;
if minute > 60 then
begin
writeln(hour,' Hour');
writeln('Left ',sisa, ' Minute');
writeln(second, ' Second');
end
else
begin
writeln(hour, ' Hour');
writeln(second,' Second');
end;
end
else
begin
write('Enter Second Amount = ');readln(second);
writeln;
hour:=second div 3600;
sisa:=second mod 3600;
minute:=sisa div 60;
sisa:=sisa mod 60;
writeln(hour,' Hour');
writeln(minute,' Minute');
writeln('Left ',sisa,' Second');
end;
writeln;
write('Conversion Again ? (Y/N) = ');readln(ask);
if ask = 'Y' then
begin
goto top;
end
end.
MORE ARTICLE
Speech To Text In Android
NOTES :
At the time the program is run, we will choose the type of time you want to convert.
At the time the program is run, we will choose the type of time you want to convert.
- If you select number 1, then you will enter the number of hours then extracted to minutes and seconds
- If you select number 2, then you will enter the number of minutes then extracted to hours and seconds and the remaining time (if any)
- If you select number 3, then you will enter the number of seconds then extracted to hours and minutes and the remaining time (if any)
Finally there will be a question, do you want to convert again? If you enter Y then the program will return from scratch, if other than Y then the program will exit.