fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main(){
  6.  
  7. int usr=0;
  8. cout << "Enter a value for usr: ";
  9. cin >> usr;
  10.  
  11. int sum=0;
  12. for(int i=1; i<=usr; i++){
  13. sum+= pow((double)i,(double)i);
  14. }
  15.  
  16. cout << endl <<sum;
  17.  
  18.  
  19. return 0;
  20. }
  21.  
  22.  
Success #stdin #stdout 0s 2728KB
stdin
4
stdout
Enter a value for usr: 
288