#include
void main(void)
{
int a;
int result;
int sum = 0;
printf(\"Enter a number: \");
scanf(\"%d\", &a);
for( int i =
pow() doesn't work with int
, hence the error "error C2668:'pow': ambiguous call to overloaded function"
http://www.cplusplus.com/reference/clibrary/cmath/pow/
Write your own power function for int
s:
int power(int base, int exp)
{
int result = 1;
while(exp) { result *= base; exp--; }
return result;
}