suma 1/1!+1/2!+.....+1/n!(factorial) - 18 October 2010 - Info - Site-ul personal al clasei 9C
Bun venit Guest | RSS
Bine ati venit la 9C acasa
Meniul Site-ului
Horoscop
Exprima-ti opinia
Ce parere aveti despre site?
1. Foarte buna
2. Foarte proasta
3. Buna
4. Normal
5. Proasta
[ Vezi rezutat ยท Arhiva ]
Raspunsuri: 42
Mini chat

Info


Main » 2010 » Octombrie » 18 » suma 1/1!+1/2!+.....+1/n!(factorial)
suma 1/1!+1/2!+.....+1/n!(factorial)
09:45
#include<iostream.h>
#include<math.h>
#include<iomanip.h>

unsigned n;
int factorial(int n)
{if(n==0)
return 1;
else
return n*factorial(n-1);}

void divide(int s,int d,int &m)
{m=(s+d)/2;}

void combina(float x,float y,float &z)
{z=x+y;}

void dei(int s,int d,float &z)
{float x1,x2;
int m;
if(s==d)
z=1./factorial(s);
else {divide(s,d,m);
      dei(s,m,x1);
      dei(m+1,d,x2);
      combina(x1,x2,z);}
}

void main()
{float z;
cout<<"n=";
cin>>n;
dei(1,n,z);
cout<<"suma "<<setprecision(2)<<z;}
Views: 808 | Added by: Iulian
Only registered users can add comments.
[ Registration | Login ]
Logheaza-te
Calendar
«  Octombrie 2010  »
DuLuMaMiJoViSa
     12
3456789
10111213141516
17181920212223
24252627282930
31
Meteo
Curs Valutar
Curs Valutar BNR
Cautare
Link-uri
Statistica
Director web gratuit - Afisare Thumbnail, Transfer Google PageRank, Meta keywords si meta description personalizate pentru fiecare link Site clasei 9C Colegiul National Mihai Eminescu, Muzica Stiri Sport, Filme Top66 Statistici
Total online: 0
Guests: 0
Users: 0