1 solutions

  • 0
    @ 2025-11-5 14:57:34

    C++ :

    #include<iostream>
    using namespace std ;
    int main ()
    {
    	float a=0,x=0;
    	while(a<=99)
    	{
    		a++;
    		x=x+1/a;
    	}
    	printf("%0.3f\n",x);
    	return 0;
    }	
    

    Pascal :

    var a,b,c:longint;
    e,d:real;
    begin
     read(a);c:=0;
     d:=0;
     for b:=1 to 100 do
     begin
     c:=c+1;
     e:=1/c;
     d:=d+e;
     end;
     writeln(d:0:3);
    end.
    
    • 1

    Information

    ID
    16266
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By