1 solutions
-
0
C :
#include<stdio.h> int main() { float i,j=1; float s=0; for(i=1;i<=10;i++) { j*=i; s+=(float)(1/j); } printf("%.5f\n",s); return 0; }C++ :
#include<iostream> using namespace std; int main() { float a=1,s=0; for(int i=1;i<=10;++i) { a*=1.0/i; s+=a; } printf("%0.5lf\n",s); return 0; }Pascal :
var h:integer;b:real; function p(a:integer):real; var s:real; m,n,j,k,i:longint; begin for i:=1 to 10 do begin n:=1; for j:=1 to i do n:=n*j; s:=s+1/n; end; p:=s; end; begin h:=10; b:=p(h); write(b:0:5); end.
- 1
Information
- ID
- 16343
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By