Вопрос задан 10.05.2019 в 11:41. Предмет Информатика. Спрашивает Трейс Тёма.

Помогите, пожалуйста Дано трехзначное число. Нужно определить есть ли в нем одинаковые цифры

Паскаль. Начало сделала, а вот ,что дальше не знаюprogram dzkan;var x,a,b,c:integer;beginwriteln(Введите трехзначное число');readln(x);a:=x div 100;b:=x mod 100 div 10;c:=x mod 10;
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Савченко Каролина.
Var a,b,c,d:integer;
Begin
readln(a);
b:=a mod 10;
c:=a mod 100 div 10; 
d:=a div 100;
If (b=c) or (b=d) or (c=d) then
writeln('YES')
else
writeln('No')
End.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

To determine if a three-digit number has identical digits, you can compare its hundreds, tens, and units digits. Here's how you can modify your Pascal program to achieve this:

```pascal program dzkan; var x, a, b, c: integer; begin writeln('Введите трехзначное число:'); readln(x); a := x div 100; // extract the hundreds digit b := (x mod 100) div 10; // extract the tens digit c := x mod 10; // extract the units digit if (a = b) or (a = c) or (b = c) then writeln('В числе есть одинаковые цифры') else writeln('В числе нет одинаковых цифр'); end. ```

In this modified program, we use the `div` operator to extract the hundreds digit (`x div 100`), the `mod` operator to extract the tens digit (`(x mod 100) div 10`), and the units digit (`x mod 10`). We then compare these digits using the `if` statement.

If any of the digits are the same, we output the message "В числе есть одинаковые цифры" (There are identical digits in the number). Otherwise, we output the message "В числе нет одинаковых цифр" (There are no identical digits in the number).

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

0 0

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

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

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