Here the code is obtained, it seems to be correct, BUT, according to the logic, it must first consider Y1 and then Y2, then the values that we got should subtract. But what I get is Y1 does not count yields, and does not take away the value. Where did I make a mistake?
program RIAD; var i, j, n1, n2: integer; Y1, Y2, Y3: real; begin write('vvedite n1= '); readln(n1); write('vvedite n2= '); readln(n2); Y1 := 1; for i := 3 to n1 - 1 do Y1 := Y1 + (1) * 1 / i; writeln('Y1=', Y2:8:4); Y2 := 1; for j := 2 to n2 do Y2 := Y2 + (1) * 1 / i; writeln('Y1=', Y2:8:4); readln; Y3 = Y1 - Y2; writeln(Y3); end.