Даны целые X и n. Вычислить sin(x)+sin(x^2)+…+sin(x^n)- Pascal(Паскаль)

uses crt;
var x,n,i,j:integer;
    s,p:real;
begin
clrscr;
writeln('Введите целые числа x,n');
readln(x,n);
s:=0;
for i:=1 to n do
 begin
  p:=1;
  for j:=1 to i do
  p:=p*x;
  s:=s+sin(p);
 end;
writeln('Sfor   =',s:0:5);
s:=0;
i:=0;
while i<n do
 begin
  i:=i+1;
  p:=1;
  for j:=1 to i do
  p:=p*x;
  s:=s+sin(p);
 end;
writeln('Swhile =',s:0:5);
s:=0;
i:=0;
repeat
  i:=i+1;
  p:=1;
  for j:=1 to i do
  p:=p*x;
  s:=s+sin(p);
until i=n;
writeln('Srepeat=',s:0:5);
readln
end.

Leave a Comment

62 + = 68