Skip to content

Instantly share code, notes, and snippets.

@david-batranu
Last active December 25, 2015 09:09
Show Gist options
  • Save david-batranu/6951621 to your computer and use it in GitHub Desktop.
Save david-batranu/6951621 to your computer and use it in GitHub Desktop.
void main(){
int a[1000]={ 0 };
int z, m, y, sum_1, n;
z = m = y = sum_1 = 0;
a[0]= 1;
while(z != 1000){
for(n = 0; n <= m; n++){
a[n] = a[n] * 2 + y;
if(a[n] <= 9){
y = 0;
}
if(a[n] > 9){
y = a[n] / 10;
a[n] = a[n] % 10;
if(n==m){
m++;
}
}
}
z++;
}
for(n = m; n >= 0; n--){
printf("%i",a[n]);
sum_1 += a[n];
}
printf("\n\nsum=%i %i\n\n", sum_1, m + 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment