#include void main(void) { int a; int result; int sum = 0; printf(\"Enter a number: \"); scanf(\"%d\", &a); for( int i =
Instead of using ^, use 'pow' function which is a predefined function which performs the Power operation and it can be used by including math.h header file.
^
math.h
^ This symbol performs BIT-WISE XOR operation in C, C++.
Replace a^i with pow(a,i).
a^i
pow(a,i)