Cod sursa(job #1005703)
Utilizator | Data | 5 octombrie 2013 15:53:47 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.26 kb |
#include <fstream>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
int n,i,p,j,s,h,x;
int main()
{f>>n;
for(h=1;h<=n;h++){
f>>x;s=0;
for(i=1;i<=x;i++){
p=1;
for(j=1;j<=i;j++)p=p*i%10;
s=s+p;
}
g<<s%10<<'\n';}
return 0;
}