Var a,b,c:array[1..5]of integer;
i:integer;
begin
for i:=1 to 5 do read(a[i]);
for i:=1 to 5 do read(b[i]);
for i:=1 to 5 do begin
if(a[i]<b[i])then c[i]:=a[i] else c[i]:=b[i];write(c[i],' ');
end;end.<span>
</span>
#include <iostream>
using namespace std;
int maks(int n)
{
int max=0,a;
for(int i=0;i<n;i++)
{
cin >> a;
if( a > max || max == 0) max = a;
}
return max;
}
int main()
{
cout << maks(4)-maks(2)+maks(5);
return 0;
}
// Поиск максимума выполнен методом инициализации изначального максимума)
Program Zadacha;
Var s: String;
c: Char;
i, pos, count:
Integer;
Begin
WriteLn('Введите слово:');
ReadLn(s);
WriteLn('Введите символ:');
ReadLn(c);
pos := 0;
count := 0;
For i := 1 To Length(s) Do
If s[i] = c Then
Begin
count := count + 1;
If pos = 0 Then
pos := i;
End;
WriteLn('Позиция символа в строке: ', pos);
WriteLn('Количество вхождений символа в строку: ', count);
ReadLn;
<span>End.</span>