Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  asd
Language: PASCAL
Code:
program Igorilinho;
var a, n, i, op : integer;
    s : real;
begin
writeln('introduceti un numar');
readln(n);
s:=0;
a:=1;
op:=0;
for i:=1 to n do
  begin
    if op = 0 then
      begin
        s:=s-1/a;
        op:=1;
      end;
    else 
      begin
        s:=s+1/a;
        op:=0;
      end;
    a:=a+1;
  end;
writeln('s = ', s);
end.
          
Comments: