Cod sursa(job #1254522)

Utilizator Danut99Dinu Danut Danut99 Data 2 noiembrie 2014 20:50:23
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <iostream>
#include <cmath>
#include <fstream>

using namespace std;

int main(){
  int n;
  ifstream inf("cifra.in");
  inf>>n;

  ofstream of("cifra.out");

  int s=0;
  int r;
  for(int y=1; y<=n;y++){
     inf>>r;
  for(int i=1; i<=r; i++){
    s=s+pow(i,i);
   }
     of<<s%10<<endl;
     s=0;
  }


  inf.close();
  of.close();

    return 0;
}