Cod sursa(job #218105)

Utilizator geniuanduOncescu Andreea geniuandu Data 31 octombrie 2008 20:19:21
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.29 kb
#include<fstream.h>
#include<math.h>
ifstream f("cifra.in");
ofstream g("cifra.out");
long t,us,n,a[100],x,ux,i,s,u;
int main()
{f>>t;
for(i=1;i<=t;i++)
{f>>n;
s=0;
x=pow(n,n);
ux=x%10;
s=s+ux;
a[i]=s;}
for(i=1;i<=t;i++)
g<<a[i]%10<<endl;
f.close();
g.close();
return 0;}