Cod sursa(job #29699)
Utilizator | Data | 9 martie 2007 19:44:32 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.24 kb |
#include<fstream.h>
#include<math.h>
int main(){
ifstream in("cifra.in");
ofstream out("cifra.out");
long n,t,i,x,j,s;
in>>n;
for(i=0;i<n;i++)
{in>>t;
s=0;
for(j=1;j<=t;j++)
{x=pow(j,j);
s+=x%10;}
out<<s%10<<"\n";}
return 0;
}