Cod sursa(job #508377)

Utilizator teo93Petrescu Teodor teo93 Data 8 decembrie 2010 01:35:36
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include<iostream>
#include<fstream>
using namespace std;
int main ()
{
	int t,n,i,j,s,aux,k;
	ifstream f("cifra.in");
	ofstream g("cifra.out");
	f>>t;
	for(i=1;i<=t;i++)
	{	f>>n;
		s=1;
		for(j=2;j<=n;j++)
		{	cout<<j<<' ';
			aux=j;
			for(k=2;k<=j;k++)
				aux=aux*j;
			s=s+aux%10;
		}
		g<<s%10<<endl;
		
	}
	f.close();
	g.close();
	return 0;
}