Вопрос задан 27.04.2019 в 15:25. Предмет Информатика. Спрашивает Богомаз Анна.

Найти все целые трёхзначные числа сумма цифр которых равна 6.Pascal ABC.Срочно

0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Бакиров Алмаз.
Var
  a,b,c: byte;
Begin
  for a := 1 to 9 do
    for b := 0 to 9 do
      for c := 0 to 9 do
        if (a+b+c = 6) then
          WriteLn(a,b,c);
End.

Вывод:

105
114
123
132
141
150
204
213
222
231
240
303
312
321
330
402
411
420
501
510
600
0 0
Отвечает Шпинь Егор.
Var a,b,c,i:integer;
begin
for i:=100 to 999 do
begin
a:= i div 100;
b:= i mod 100 div 10;
c:= i mod 10;
if a+b+c = 6 then writeln(i)
end;
readln
end.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Finding Three-Digit Numbers with a Sum of Digits Equal to 6 in Pascal ABC

To find all the three-digit numbers with a sum of digits equal to 6 in Pascal ABC, we can use a simple algorithm to iterate through all the three-digit numbers and check if the sum of their digits equals 6.

Here's a simple Pascal ABC code to achieve this:

```pascal program ThreeDigitNumbers;

var num, digit1, digit2, digit3, sum: integer;

begin for num := 100 to 999 do begin digit1 := num div 100; digit2 := (num div 10) mod 10; digit3 := num mod 10; sum := digit1 + digit2 + digit3; if sum = 6 then writeln(num); end; end. ```

In this code, we iterate through all the three-digit numbers from 100 to 999. For each number, we extract its individual digits and calculate their sum. If the sum equals 6, we output the number.

Output

The above code will output all the three-digit numbers with a sum of digits equal to 6 in Pascal ABC.

Conclusion

Using the provided Pascal ABC code, you can find all the three-digit numbers with a sum of digits equal to 6. This algorithm iterates through all the three-digit numbers and checks for the required condition, providing the desired output.

0 0

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

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

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