#include <iostream>
<span>#include <ctime>
</span><span>using namespace std;
</span>int main() {
<span> int n,m;
</span><span> FILE *fpt;
</span><span> cout<<"n = "; cin>>n;
</span><span> fpt=fopen("input.dat","wb");
</span><span> srand(time(NULL));
</span><span>// запись файла
</span><span> for (int i=0; i<n; i++) {
</span><span> m=rand()%8000-3000;
</span><span> cout<<m<<" ";
</span><span> fwrite(&m,sizeof(int),1,fpt);
</span><span> }
</span><span> cout<<endl;
</span><span> fclose(fpt);
</span><span> fpt=fopen("input.dat","rb+");
</span><span> int indf=0,indl=0,vf=0,vl=0,k=0;
</span><span>// чтение файла
</span><span> while (fread(&m,sizeof(int),1,fpt)!=0) {
</span><span> k++;
</span><span> if (!(m%2==0) && (indf==0)) { indf=k-1; vf=m; }
</span><span> if ((!m==0) && (m%2==0)) { indl=k-1; vl=m; }
</span><span> }
</span><span> cout<<"first odd = "<<vf<<" index = "<<indf<<endl;
</span><span> cout<<"last even = "<<vl<<" index = "<<indl<<endl;
</span><span>// обмен первого нечетного и последнего четного
</span><span> if (indf>0) {
</span><span> fseek(fpt,sizeof(int)*indf,SEEK_SET);
</span><span> fwrite(&vl,sizeof(int),1,fpt);
</span><span> }
</span><span> if (indl>0) {
</span><span> fseek(fpt,sizeof(int)*indl,SEEK_SET);
</span><span> fwrite(&vf,sizeof(int),1,fpt);
</span><span> }
</span><span> fclose(fpt);
</span><span> system("pause");
</span><span> return 0;
</span><span>}
</span>n = 6
<span>4368 2733 1112 2620 1941 753
</span><span>first odd = 2733 index = 1
</span><span>last even = 2620 index = 3
</span>
Sub m2()
Cells.Clear
Dim n As Integer, i As Integer, min As Integer
n = InputBox("n(>5) = ")
Cells(1, 1).Value = "n = " + Str(n)
ReDim a(1 To n)
For i = 1 To n
a(i) = InputBox("a(" + Str(i) + ")")
Next i
Cells(2, 1).Value = "Исходный массив"
Range(Cells(3, 1), Cells(3, n)).Value = a
min = a(1)
For i = 2 To n
If a(i) < min Then min = a(i)
Next i
Cells(4, 1).Value = "min = " + Str(min)
Cells(5, 1).Value = "Полученный массив"
For i = n - 4 To n
a(i) = min
Next i
Range(Cells(6, 1), Cells(6, n)).Value = a
End Sub
Var a,b:real;
begin;
readln(a);
readln(b);
writeln(a+b);
writeln(a-b);
writeln(a*b);
end.