
Лука
6 год назад
Задание №309. ГолосованиеНапишите "функцию голосования"function Election (x, y, z:boolean): booleanВходные данныеВводится 3 числа - x, y и z (x, y и z равны 0 или 1, 0 соответствует значению false, 1 соответствует значению true).Выходные данныеНеобходимо вывестизначение функции от x, y и z.Примеры0 0 10
ОТВЕТЫ

Димитричка
Oct 24, 2020
Program n1;
var x,y,z: integer;
function Election(x,y,z: integer ): boolean;
begin
if(x=0) and (y=0) then Election:=false
else
begin
Election:=true;
if (x=0) and (z=0) then Election:=false
else
begin
Election:=true;
if (y=0) and (z=0) then Election:=false
else Election:=true;
end;
end;
end;
begin
readln(x,y,z);
if Election(x,y,z)=true then
writeln(1) else writeln(0);
end.
var x,y,z: integer;
function Election(x,y,z: integer ): boolean;
begin
if(x=0) and (y=0) then Election:=false
else
begin
Election:=true;
if (x=0) and (z=0) then Election:=false
else
begin
Election:=true;
if (y=0) and (z=0) then Election:=false
else Election:=true;
end;
end;
end;
begin
readln(x,y,z);
if Election(x,y,z)=true then
writeln(1) else writeln(0);
end.
225
Смежные вопросы: