Cod sursa(job #675857)

Utilizator ArmandNMArmand Nicolicioiu ArmandNM Data 8 februarie 2012 12:59:09
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.28 kb
#include <fstream.h>
#include <math.h>
ifstream f("cifra.in");
ofstream g("cifra.out");
int T,N,i,y,s,u;
int main()
{
	f>>T;
	for (i=1;i<=T;i++)
	{
		s=0;
		f>>N;
		for (y=1;y<=N;y++)
			s=s+pow(y,y);
		u=s%10;
		g<<u<<endl;
	}
	f.close(); g.close();
	return 0;
}