Cod sursa(job #119706)
Utilizator | Data | 2 ianuarie 2008 20:24:55 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.24 kb |
#include<fstream.h>
#include<math.h>
ifstream f("cifra.in");
ofstream g("cifra.out");
int main()
{int a[100],i,j,t,s,q;
f>>t;
for(i=1;i<=t;i++)f>>a[i];
for(i=1;i<=t;i++){s=0;
for(j=1;j<=a[i];j++){q=pow(j,j);
s=s+q%10;}
g<<s%10;
g<<endl;}}