Cod sursa(job #1295816)

Utilizator tudor199G Tudor tudor199 Data 20 decembrie 2014 11:29:48
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <iostream>
#include <fstream>
#include <math.h>

using namespace std;

int main()
{
    int a,s=0,t=1,b=1;
    fstream f("cifra.in",ios::in);
    fstream g("cifra.out",ios::out);
    f>>a;
    while(b<=a)
    {
        while(t)
        {
            s=s+pow(t,t);
            t--;
        }
        s=s%10;
        g<<s<<endl;
        s=0;
        b++;
        t=b;
    }
    f.close();
    g.close();
    return 0;
}