Cod sursa(job #23113)

Utilizator LiviutPorumb Dany Liviut Data 28 februarie 2007 09:44:22
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include <iostream.h>
#include<fstream.h>
int n,i,j,k;
int main(){
    fstream f("cifra.in",ios::in);
    fstream g("cifra.out",ios::out);
    f>>n;
   
    while(f>>n)
    {
        j=1;
        for(k=2;k<=n;k++)
        {
            j=j+pow(k%10,k%10);
            j=j%10;
        }
        g<<j<<endl;
    }
    f.close();
    g.close();
}