Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3000米长的绳子,每天减一半。问多少天这个绳子会小于5米?不考虑小数。 #36

Open
Sogrey opened this issue Apr 23, 2019 · 0 comments
Labels
Java java相关

Comments

@Sogrey
Copy link
Owner

Sogrey commented Apr 23, 2019

public static void main(String[] args){
	int day = 0;
	for(int x=3000; x>=5; x/=2){
		day++;
	}
	System.out.println("day="+day);
	/*
	方法二:
	day = 0;
	for(int x=3000; x>=5; day++)
	{
		x = x/2;
	}
	System.out.println(day);
	*/
}
@Sogrey Sogrey added the Java java相关 label Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java java相关
Projects
None yet
Development

No branches or pull requests

1 participant