Skip to content

Instantly share code, notes, and snippets.

@kenornotes
Created January 7, 2015 13:44
Show Gist options
  • Save kenornotes/12b400919ccbd64ad223 to your computer and use it in GitHub Desktop.
Save kenornotes/12b400919ccbd64ad223 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int func(int price) {
int count = 0;
while(price > 50) {
price = price / 2;
count = count + 1;
}
return count;
}
int main() {
int n;
scanf("%d", &n);
if(n > 0) {
printf("%d 次",func(n));
} else {
printf("error");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment