Даны две переменные. составить алгоритм, который уменьшит обе переменные на 5, если хотя бы одна из них больше 15, иначе выдаёт соответствующее сообщение
Var a,b:real; Begin Write('a = ');ReadLn(a); Write('b = ');ReadLn(b); if (a>15)or(b>15) then Begin a:=a-5; b:=b-5; WriteLn(a,' ',b); End else Write('Соответствующее сообщение'); End.
Вариант 1 var str:string; A,B,i:integer; begin write('введите ваш текст'); readln(str); for i:=1 to length(str) do begin if (str[i]='А')or (str[i]='а') then a:=a+1; if (str[i]='Б')or (str[i]='б') then B:=b+1; end; if (A+B)=0 then write('нет таких букв') else write ('A= ',A,' Б= ',b); end.
вариант 3 var str:string; A,B,i:integer; begin write('введите ваш текст'); readln(str); i:=1; while i<=length(str) do begin if (str[i]='А')or (str[i]='а') then delete(str,i,1); i:=i+1; end; write(str); end.
Program aaa; var Y:array[1..1000,1..1000] of longint; n,m,i,j,count5,countm9,s5,sm9:longint; begin writeln('введите размерность массива'); read(n,m); writeln('введите массив'); for i:=1 to n do for j:=1 to m do read(Y[i,j]); count5:=0; countm9:=0; s5:=0; sm9:=0; for i:=1 to n do for j:=1 to m do begin if Y[i,j]>5 then begin inc(count5); s5:=s5+Y[i,j] end; if Y[i,j]<-9 then begin inc(countm9); sm9:=sm9+Y[i,j] end; end; writeln('всего элементов больше 5:',count5,' ,сумма этих элементов равна:',s5); writeln('всего элементов меньше -9:',countm9,' ,сумма этих элементов равна:',sm9) end.
a,b:real;
Begin
Write('a = ');ReadLn(a);
Write('b = ');ReadLn(b);
if (a>15)or(b>15) then
Begin
a:=a-5;
b:=b-5;
WriteLn(a,' ',b);
End
else Write('Соответствующее сообщение');
End.