View Code of Problem 64

public class t12_3 {
	public static int gong(int k)
	{
		int i;
		for(i=1;i<=10;i++)
		{	if(i==2)
				return k=2;
		else
			return k=(k-gong(k/2)+i);
		}
		return k;		
	}
	public static void main(String args[]){
		int k,L,n;
		k=2;
		n=10;
		L=10;
		if(gong(k)>L)
			System.out.println(k);
	}
}
/*
Main.java:1: error: class t12_3 is public, should be declared in a file named t12_3.java
public class t12_3 {
       ^
1 error
*/

Double click to view unformatted code.


Back to problem 64