Предмет: Информатика, автор: Аноним

Ниже записан алгоритм. Получив на вход число x, этот алгоритм печатает два числа a и b. Укажите наименьшее пятизначное число x, при вводе которого алгоритм печатает сначала 5, а потом 3.
Паскаль
var x, y, a, b: longint;
begin
a := 0;
b := 0;
readln(x);
while x > 0 do begin
y := x mod 10;
if y > 3 then a := a + 1;
if y < 8 then b := b + 1;
x := x div 10
end;
writeln(a);
writeln(b)
end.
СИ
int a, b, x, y;
scanf(″%d″, &x);
a = 0; b = 0;
while (x > 0)
{
y = x % 10;
if (y>3) a=a+1;
if (y<8) b=b+1;
x=x/10;
}
printf(″%d\n%d″, a, b);

Ответы

Автор ответа: leonidkorolev2007
2

Ответ:

44488

Объяснение:

Нужно найти такое минимальное 5значное число у которого 5 цифр больше 3 (if y > 3 then a := a + 1;) и три цифры меньше 8 (if y < 8 then b := b + 1;). Минимальные цифры больше трех 44444, но надо только три меньше 8. Восьмерки добавим в конец. Получается 44488.


Аноним: Слушай, а можешь ещё с одним заданием помочь?
leonidkorolev2007: да
Похожие вопросы
Предмет: Английский язык, автор: Аноним

That nice afternoon Mary Poppins took Jane and Michael to her uncle,Mr. Wigg.It was a long way to Number Three,Robertson Road.Mary Poppins rang the ball, the door flew open and a thin lady out.

    "How do you do, Mrs. Wigg" said Jane

     "Mrs.Wigg !" said the thin lady. " No, thank you!I'm Miss Persimmon and am proud of it!" Jane and Michael looked at each other. They thought that Mr. Wigg was a very special person if the lady was so glad not be Mrs.  Wigg.

     Jane and Michael followed Mary Poppins upstairs.

   " Come in! And welcome !" called a loud voice from inside.

   Mary Poppins opened the door and they came into a nice large room. There was a fireplace in the corner and in the middle of the room there was a big table with four cups, bread and butter, biscuits , chocolates and a large cherry cake.

   " Nice to see you , " somebody said. Jane and Michael looked around but saw nobody.

     " Oh, Uncle Albert- not again ! It's not your birthday , is it ?" Mary Poppins said and looked up. Jane and Michael looked up too and saw a round , fat man in the air . Indeed, he was sitting in the air and reading a newspaper.

   "My dear," said Mr. Wigg , smiling down at them , " I'm very sorry , but it is my birthday ." he said , looking down at Jane and Machael.

     " I can see you're a little surprised , " said Mr. Wigg . And indeed , their mouths were so wide open ! " You see, I'm happy sort of man . I can smile  and laugh at everythings , " said Mr. Wigg.

      ОЧЕНЬ СРОЧНО ТОЛЬОК ПЛИЗ БЕЗ ПЕРЕВОДЧИКА ......