loading...

re: Daily Coding Challenge #45 VIEW POST

FULL DISCUSSION
 

hello ;)
if it were an array you can do it like this .. oh yes i didnt compile so figure to fix code .. remember nothing complete.. happy coding

int A[] = {4,9,0,5,1};
int len = sizeof(A)/sizeof(A*); // length
int i=0; int L=0;

while(i<len-3)
{
L = ((i+1)*2)-1;

if (L<len-3) A[L++]+=A[i]*10;
if (L<len-3) A[L]+=A[i++]*10;
}
L=0;
while(len-i) L+=A[i]+A[i++ +1];

Code of Conduct Report abuse