#include "stdafx.h"
#include <iostream>
using namespace std;
int fakt(int x) {
unsigned long tot=1;
for(;x>0;x--) {
tot*=x;
}
return tot;
};
bool check(int x[],int k,unsigned long y) {
int tot=0,c=0;
do {
tot+=fakt(x[k]);
k--;
}while(k>=0);
if(tot==y) {
return true;
}else {
return false;
}
}
void make() {
int result =0;
for(unsigned long i=10;i<100000;i++) {
int * dizi = new int[15];
int k=0,c=i;
do {
dizi[k] = c % 10;
c/=10;
k++;
}while(c>0);
if(check(dizi,k-1,i)==true) {
result+=i;
cout << i << endl;
}
}
cout << "Result :" << result << " efekanpulatli.blogspot.com" << endl;
}
int main() {
make();
system("pause");
return 0;
}

Hiç yorum yok:
Yorum Gönder