Skip to content

Instantly share code, notes, and snippets.

@sams96
Created September 3, 2013 11:10
Show Gist options
  • Save sams96/6422519 to your computer and use it in GitHub Desktop.
Save sams96/6422519 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(){
int a = 29;
int b = 34;
int tot;
printf("A\tB\n");
while (a != 1){
a = a / 2;
b *= 2;
printf("%d\t%d\n", a, b);
if (a % 2 != 0){
tot += b;
//printf("---");
}
}
printf("%d\n", tot);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment