program CountZeros; var num1, num2, num3: integer; countZeros: integer; begin writeln('Enter three numbers:'); readln(num1, num2, num3); countZeros := 0; if num1 = 0 then countZeros := countZeros + 1; if num2 = 0 then countZeros := countZeros + 1; if num3 = 0 then countZeros := countZeros + 1; writeln('The number of zeros is: ', countZeros); end.
Пример работы программы:
Enter three numbers: 0 5 0 The number of zeros is: 2
var
num1, num2, num3: integer;
countZeros: integer;
begin
writeln('Enter three numbers:');
readln(num1, num2, num3);
countZeros := 0;
if num1 = 0 then
countZeros := countZeros + 1;
if num2 = 0 then
countZeros := countZeros + 1;
if num3 = 0 then
countZeros := countZeros + 1;
writeln('The number of zeros is: ', countZeros);
end.
Пример работы программы:
Enter three numbers:0
5
0
The number of zeros is: 2