Pagini recente » Cod sursa (job #1641391) | Cod sursa (job #2799625) | Cod sursa (job #1779867) | Cod sursa (job #1803503) | Cod sursa (job #48573)
Cod sursa(job #48573)
#include<fstream.h>
#include<math.h>
int main()
{
double j,a,b,s,y,y1,i,x,xy;
ifstream f("cifra.in");
ofstream g("cifra.out");
f>>a;
for(i=1;i<=a;i++)
{
f>>b;
if(fmod(b,10)==0)
s=7;
else
{
y=fmod(b,100);
y=y/10;
x=modf(y,&xy);
x=fmod(b,10);
xy=xy*47;
xy=fmod(xy,10);
s=xy;
s=fmod(s,10);
y=fmod(b,4);
if(y==0)
y=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);
if(y==0)
y=4;
y1=fmod(b,10);
y=pow(y1,y);
s=s+fmod(y,10);
}
}
g<<fmod(s,10)<<"\n";
}
return 0;
}