Cod sursa(job #363975)

Utilizator cristian9Cristian Zloteanu cristian9 Data 15 noiembrie 2009 10:34:40
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.27 kb
#include<fstream.h>
#include<math.h>
ifstream q ("cifra.in");
ofstream w ("cifra.out");
int main()
{int n,t,i,z,r,s=0;
q>>t;
	for(i=1;i<=t;i++){
		q>>n;
			while(n!=0){
				z=pow(n,n);
				s=s+z;
				n--;}
			r=s%10;
			w<<r<<"\n";
			s=0;
			}
return 0;
}