
Составить программу в паскале1)Игровой автомат выдает целые числа от 0 до 10 если выпадает 7, то
выйгрыш.2)Игровой автомат получает 3 случайных числа от 0 до 10, если числа совпадут, то выйгрыш3)Вывести на экран 10 случайных чисел от 0 до 100, и определить сколько из них чётныхОчень надо к завтрашнему дню, заранее спасибо.

Ответы на вопрос

var
i:integer;
begin
randomize;
i:=random(11);
writeln('vipalo chislo: ',i)
;if (i = 7) then writeln('POBEDA!') else writeln('Pobrobyite eshe!');
end.
2)
var
i_1,i_2,i_3:integer;
begin
randomize;
i_1:=random(11);
i_2:=random(11);
i_3:=random(11);
writeln('vipalo chislа: ',i_1,' ',i_2,' ',i_3);
if (i_1 = i_2)and(i_2 = i_3) then writeln('Winer!') else writeln('Sorry,try again!')
end.
3) var i, k, z: integer;
begin
randomize;
k := 0;
for i := 1 to 10 do
begin
z := random(101);
write(' ', z);
if odd(z) then k := k + 1;
end;
writeln;
writeln('Kolichestvo chetnysh: ', k);
end.



Program in Pascal: Game Machine
Here is a program in Pascal that implements the three requirements you mentioned:
```pascal program GameMachine;
uses crt;
var randomNumber, count, evenCount: integer;
begin randomize; // Initialize random number generator
// 1) Game machine that outputs numbers from 0 to 10 writeln('1) Game machine that outputs numbers from 0 to 10:'); randomNumber := random(11); // Generate a random number from 0 to 10 writeln('Random number:', randomNumber); if randomNumber = 7 then writeln('You win!') else writeln('You lose!');
// 2) Game machine that receives 3 random numbers from 0 to 10 writeln('2) Game machine that receives 3 random numbers from 0 to 10:'); count := 0; repeat randomNumber := random(11); // Generate a random number from 0 to 10 writeln('Random number:', randomNumber); count := count + 1; until count = 3;
if (randomNumber = random(11)) and (randomNumber = random(11)) then writeln('You win!') else writeln('You lose!');
// 3) Display 10 random numbers from 0 to 100 and determine the count of even numbers writeln('3) Display 10 random numbers from 0 to 100 and determine the count of even numbers:'); evenCount := 0; for count := 1 to 10 do begin randomNumber := random(101); // Generate a random number from 0 to 100 writeln('Random number:', randomNumber); if randomNumber mod 2 = 0 then evenCount := evenCount + 1; end;
writeln('Number of even numbers:', evenCount);
readln; end. ```
This program consists of three parts:
1) The game machine that outputs numbers from 0 to 10. If the number 7 is generated, it displays "You win!" Otherwise, it displays "You lose!". 2) The game machine that receives three random numbers from 0 to 10. If all three numbers are the same, it displays "You win!" Otherwise, it displays "You lose!". 3) It displays 10 random numbers from 0 to 100 and determines the count of even numbers.
Please note that the `randomize` procedure is used to initialize the random number generator, and the `random` function is used to generate random numbers within the specified range.
I hope this helps! Let me know if you have any further questions.


Топ вопросов за вчера в категории Информатика







Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili