Program N1(input, output);
Var s: real;
n: integer;
begin
s:=o; n:=1;
while n<=50 do
begin s:=s+1/n;
n:=n+1;
end;
writeln(‘yigindi kiymati s=’,s);
end.
bu yugindini hisoblash dasturida takrorlanish jarayoni n ning kiymati 50ga teng bulguncha davom etadi.
N ning kiymati 50 dan katta bo’lganidan yigindini kymatlarini hisoblash jarayoni tuxtatiladi va natija ekranga chikariladi.
Natija s=4.499...
n=1…500
tamom
S=
S=s+1/n
boshlash
|
Endi ushbu dasturni for operatoridan foydalanib tuzamiz
|
Do'stlaringiz bilan baham: |