-4
void sommeascf(n)
    for(i=1; i<=n; i++){
        result= result+ 1/i^n
    }
}

the problem I'm facing is :

result = result + 1/i^n

How can I put the power function into this arithmetic operation ?

Dipak Panchal
  • 5,996
  • 4
  • 32
  • 68

1 Answers1

4

^ this is bitwise XOR operator in C . You can write that expression using pow function like this -

result= result+ 1/(pow(i,n));

Note - You need to include header <math.h>

ameyCU
  • 16,489
  • 2
  • 26
  • 41