Cod sursa(job #1130124)

Utilizator Viorell008Iordache Viorel Viorell008 Data 28 februarie 2014 11:25:03
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include<iostream>
#include<fstream>
using namespace std;
ifstream x("cifra.in");
ofstream y("cifra.out");
int main ()
{
    int i,nr,n,s,c,m,k,j;
    x>>n;
    for(i=1;i<=n;i++)
    {
        x>>nr;
        s=0;
        for(j=1;j<=nr;j++)
        {m=1;
            for(k=j;k!=0;k--)
            {
                m=m*j;
            }
            s=s+m;
        }
        c=s%10;
        y<<c<<endl;
    }
    x.close();
    y.close();
    return 0;
}