Write a program that, depending on the entered number of minutes (M = 60), will substitute the word
Write a program that, depending on the entered number of minutes (M = 60), will substitute the word minute in the required case For example, 25 minutes31 minutes53 minutes (using the CASE operator and the DIV and MOD operations)
It is possible to use a mod without a div:
program minutes;
var m: integer;
begin
write (‘Enter the number of minutes (1 to 60)’);
readln (m);
case m mod 10 of
0, 5, 6, 7, 8, 9: writeln (m, ‘minutes’);
1: writeln (m, ‘minute’);
2, 3, 4: writeln (m, ‘minutes’)
end
end.
It is possible to use a div without mod:
program minutes;
var m, k: integer;
begin
write (‘Enter the number of minutes (from 1 to 60):’);
readln (m);
k: = m – (m div 10) * 10;
case k of
0, 5, 6, 7, 8, 9: writeln (m, ‘minutes’);
1: writeln (m, ‘minute’);
2, 3, 4: writeln (m, ‘minutes’)
end
end.