Вопрос задан 31.07.2018 в 06:21. Предмет Информатика. Спрашивает Шишкин Родион.

Помогите! составить программу в паскале.У младенца Кузьки вылезло уже s зубов, а у его бабы Дуси

осталось w зуба. Задать с помощью генератора случайных чисел 2 целых числа от 0 до 5 – значения для s и w. У кого зубов больше?
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Игнатюк Лиза.
Program Rinok;
Const x0=0;x1=5;
Var s,w: integer;
begin
Randomize;
s:=Random(X1-X0)+X0;
w:=Random(X1-X0)+X0;
writeln('у Кузи-',s);
writeln('у Дуси-',w);
if  (s>w)
then 
Writeln ('-у Кузи больше')
else 
Writeln ('-у Дуси больше');
Readln
end.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

To write a program in Pascal that compares the number of teeth between two individuals, Kuzka and Dusi, you can follow these steps:

1. Declare the variables for the number of teeth for Kuzka and Dusi: - Use the `var` keyword to declare the variables. - Assign random values between 0 and 5 to the variables using a random number generator.

2. Compare the number of teeth: - Use an `if` statement to compare the values of the variables. - Print the result indicating who has more teeth.

Here's an example of how the program could be written in Pascal:

```pascal program TeethComparison;

var KuzkaTeeth, DusiTeeth: Integer;

begin // Generate random values for Kuzka and Dusi's teeth Randomize; KuzkaTeeth := Random(6); // Generates a random number between 0 and 5 DusiTeeth := Random(6); // Generates a random number between 0 and 5

// Compare the number of teeth if KuzkaTeeth > DusiTeeth then writeln('Kuzka has more teeth than Dusi.') else if KuzkaTeeth < DusiTeeth then writeln('Dusi has more teeth than Kuzka.') else writeln('Kuzka and Dusi have the same number of teeth.');

// Wait for user input before closing the program readln; end. ```

This program declares two variables, `KuzkaTeeth` and `DusiTeeth`, and assigns random values between 0 and 5 to them using the `Random` function. It then compares the values using an `if` statement and prints the result. Finally, it waits for user input before closing the program.

Please note that the program uses the `Randomize` procedure to initialize the random number generator. This ensures that the random values generated are different each time the program is run.

I hope this helps! Let me know if you have any further questions.

0 0

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

Последние заданные вопросы в категории Информатика

Задать вопрос