#include "stdio.h"
#include "math.h"
void main(void)
{
int a;
int result;
int sum=0;
printf("Enter a Number : ");
scanf("%d",&a);
for(int i=1;i<=4;i++)
{
result = a^i;
sum =sum+result;
}
printf("%d\n",sum);
}
I don't know why this '^' is not working as power.
You actually have to use pow(number, power);. Unfortunately, carats don't work as a power sign in C. Many times, if you find yourself not being able to do something from another language, its because there is a diffetent function that does it for you.