1 solutions
-
0
C :
#include<stdio.h> int main() { int i; double s=0,a; for(i=1;i<=100;i++) { a=0; a=1.0/i; s=s+a; } printf("%.3lf",s); return 0; }C++ :
#include<iostream> #include<cstdio> using namespace std; int main() { float a=0; for(int i=1;i<=100;++i) a=a+1.0/i; printf("%0.3lf\n",a); return 0; }Pascal :
program aa; var a,d,e,max,min:longint; b,c:real; begin b:=0; c:=0; for a:=1 to 100 do begin b:=1/a; c:=c+b; end; write(c:0:3); end.
- 1
Information
- ID
- 16257
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By