djgas10
12.01.2021 19:58

Укажите наибольшее натуральное трёхзначное число x, при вводе которого будут напечатаны числа 1 и 2.

pascal:
var
x, a, b : integer;
begin
read(x);
a : = 0; b : = 0;
while x > 0 do begin
if x mod 8 mod 3 > 1 then
a : = a + 1;
if x mod 8 mod 3 < 1 then
b : = b + 1;
x : = x div 8
end;
writeln(a, ' ', b)
end.

c++:
#include

int main() {
int x, a = 0, b = 0;
std: : cin > > x;
while (x > 0) {
if (x % 8 % 3 > 1)
a++;
if (x % 8 % 3 < 1)
b++;
x /= 8;
}
std: : cout < < a < < " " < < b;
}

basic:
dim x, a, b as integer
input x
a = 0 : b = 0
while x > 0
if x mod 8 mod 3 > 1 then
a = a + 1
end if
if x mod 8 mod 3 < 1 then
b = b + 1
end if
x = x \ 8
wend
print a, " ", b

python:
x = int(
a = b = 0
while x > 0 :
if x % 8 % 3 > 1 :
a += 1
if x % 8 % 3 < 1 :
b += 1
x //= 8
print(a, b)

Нажмите на рекламу ниже и сразу увидите ответ
↓
Популярные вопросы:
Ответ:
Elka29677
17.12.2020 04:08
 --- gfortran 6.3 ---
program prog1
integer N, k, i, j
real a(10,10)
read *, N
print *, 'Матрица:'
do i = 1,N
 do j = 1,N
   a(i,j) = sin(1.0*i+1.0*j/2)
 end do
end do
do i = 1, N
 print *, (a(i,j), j=1,N)
end do
k = 0
do i = 1, N
 do j = 1, N
  if(a(i, j) > 0) k = k+1
 end do
end do 
print *, k
end

Результат:
4
Матрица:
   0.997494996 0.909297407 0.598472118 0.141120002
   0.598472118 0.141120002 -0.350783229 -0.756802499
  -0.350783229 -0.756802499 -0.977530122 -0.958924294
  -0.977530122 -0.958924294 -0.705540299 -0.279415488
      6
0,0(0 оценок)
Ответ:
asya13051
09.07.2022 17:25
1)
Program lapy;
var lapy:integer;
Begin
  Writeln('Сколько лап?');
  Readln(lapy);
  If lapy=0 then Writeln('Это рыба');
  if lapy=2 hten Writeln('Это птица');
  if lapy=4 then Writeln('Это лось');
  if lapy=6 then Writeln('Это жук');
  if lapy=8 then Writeln('Это паук');
end.
2)
Program kinotheatr;
var mesto:integer;
Begin
  Writel('Укажите Ваше место:');
  Readln(mesto);
  if (mesto>=1) and (mesto<=10) then Writeln('Цена 150р.');
  if (mesto>=11) and (mesto<=15) then Writeln('Цена 100р.');
  if (mesto>=16) and (mesto<=20) then Writeln('Цена 75р.');
End.
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота