Solve power then 1/power and add them.
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
float num;
float sum = 1, temp, c = 2;
cin >> num;
while (c < num)
{
temp = pow(c, c);
sum += 1 / temp;
c++;
}
cout << sum << endl;
system("pause");
}
Comments
Post a Comment