Cod sursa(job #212501)
Utilizator | Data | 5 octombrie 2008 18:46:39 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include<iostream.h>
#include<fstream.h>
#include<math.h>
void main()
{
ifstream f1;
f1.open("cifra.in");
int t,n,i,k,f=0;
f1>>t;
ofstream f2;
f2.open("cifra.out");
for(i=0;i<t;i++)
{
f1>>n;
for(k=1;k<=n;k++)
{
f=f+pow(k,k);
if(f>=10) f=f%10;
}
f2<<f<<endl;
f=0;
}
}