base on char*:
char *base = "234";
int sqdNumber_result = 0;
for(int i = 0; i < strlen(base); i++)
{
sqdNumber_result += ((base[i]-48) * (base[i]-48));
}
based on int:
int base = 234;
int sqdNumber_result = 0;
while(base)
{
sqdNumber_result += ((base % 10) * (base % 10));
base /= 10;
}
its in my mind, but i think will work
i don't know what dataype you use as base