Pagini recente » Cod sursa (job #865990) | Cod sursa (job #1188300) | Cod sursa (job #2887285) | Cod sursa (job #145218) | Cod sursa (job #120829)
Cod sursa(job #120829)
#include <fstream.h>
#include <math.h>
int main() {
ifstream f("cifra.in");
register int n, i = 1, y;
unsigned long int t, aux, aux2=0;
ofstream fout("cifra.out");
f>>n;
while (i <= n) {
f>>t;
for (y = 1; y <= i; y++) {
aux = pow(y, y);
aux2 += aux%10;
if(aux2 > 9)
aux2 = aux2 % 10;
}
fout<<aux2<<'\n';
i++;
aux = 0;
aux2 = 0;
}
f.close();
fout.close();
return 0;
}