После выполнения команды присваивания x:= x+y значение переменной хрaвнo 2, а значение переменной у равно 25. Чему были равны значения переменных хи у до выполнения указанной команды присваивания? ответ: х = у =
Program Sum; Var a, b: Integer; Begin Write('a = '); ReadLn(a); Write('b = '); ReadLn(b); WriteLn('Сумма a и b равна ', a + b); ReadLn; End.
Program SumRow; Const min = 5; max = 28; Var a, i: Integer; Begin a := 0; For i := min To max Do a := a + i; WriteLn('Сумма ряда равна ', a); ReadLn; End.
Program Digit; Var a, b: LongInt; c, d, i: Integer; Begin Write('a = '); ReadLn(a); b := 1; c := 0; While a Div b <> 0 Do Begin c := c + 1; b := b * 10; End; While a > 0 Do Begin d := d + (a Mod 10); a := a Div 10; End; WriteLn('Количество цифр в числе равно ', c); WriteLn('Сумма цифр числа равна ', d); ReadLn; End.
Uses crt; const n=4; m=4; var a:array[1..n,1..m] of integer; s,i,j,p:integer; begin randomize; for i:=1 to n do for j:=1 to m do a[i,j] := random(99); for i:=1 to n do begin for j:=1 to m do write(a[i,j]:3); writeln; end; writeln; p:=1; for i:=1 to n do for j:=1 to m do if i=j then p:=p*a[i,j]; s:=0; if (a[1,2]*a[2,3]*a[3,4]=p) then s:=s+a[1,2]+a[2,3]+a[3,4]; if (a[1,3]*a[2,4]=p) then s:=s+a[1,3]+a[2,4]; if a[4,4]=p then s:=s+a[4,4]; if (a[2,1]*a[3,2]*a[4,3]=p) then s:=s+a[2,1]+a[3,2]+a[4,3]; if (a[1,3]*a[2,4]=p) then s:=s+a[2,1]+a[3,2]; if a[1,4]=p then s:=s+a[1,4]; writeln(s); end.
23
2
тк x: = x+y
x была постоянной
значит
y-x=23
y=23
x=2