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

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

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.



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.


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