Cod sursa(job #92880)

Utilizator SofinetiSofineti Mihai Sofineti Data 16 octombrie 2007 20:15:22
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include<stdio.h>
#include<math.h>
int cifra(int x){long i,s=0;
		 for(i=1;i<=x;i++) {s=s+pow(i,i);s=s%10; }
		 return s;
		 }
int main()
{       long t,i,x;
freopen("cifra.in","r",stdin);
freopen("cifra.out","w",stdout);

scanf("%ld",&t);
for(i=0;i<t;i++){
		scanf("%ld",&x);
		x=cifra(x);
		printf("%ld\n",x);
		}
return 0;
}