Pagini recente » Cod sursa (job #1134048) | Clasament Summer Challenge Unu | Cod sursa (job #155134) | Cod sursa (job #1370883) | Cod sursa (job #47747)
Cod sursa(job #47747)
#include<fstream.h>
#include<math.h>
int main()
{
double j,a,b,s,y,y1,i,x;
ifstream f("cifra.in");
ofstream g("cifra.out");
f>>a;
for(i=1;i<=a;i++)
{
f>>b;
x=fmod(b,10);
s=0;
y=fmod(b,4);
y1=fmod(b,10);
y=pow(y1,y);
s=s+fmod(y,10);
for(j=1;j<x;j++)
{
b=b-1;
y=fmod(b,4);
y1=fmod(b,10);
y=pow(y1,y);
s=s+fmod(y,10);
}
g<<fmod(s,10)<<endl;
}
return 0;
}