Cod sursa(job #77169)
Utilizator | Data | 13 august 2007 15:20:09 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{ ifstream fi("cifra.in");
ofstream fo("cifra.out");
int t,i,n,k,a;
n=0;
fi >> t;
k=1;
while (k<=t)
{ a=1;
for (i=0;i<k;i++)
a = a*k;
n = n + a;
fo << n%10;
k++;
}
fi.close();
fo.close();
system("pause");
return 0;
}