Created
January 7, 2015 13:44
-
-
Save kenornotes/12b400919ccbd64ad223 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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