How to calculate the sum of a series of self powers numbers in C++

1 Answer

0 votes
#include <iostream>
#include <cmath>
  
int main(void) {
    float sum = 0.0;

    for (int i = 1; i < 11; i++) {
        sum += pow(i, i); 
    }
     
    std::cout << sum;
}
   
   
 
   
/*
run:
   
1.04051e+10
   
*/

 



answered Jan 24, 2024 by avibootz
...