Testproblem

Status
Nicht offen für weitere Antworten.

andy0566

Mitglied
wer kann mir helfen, wie bekommt man die Lösung:

512
256
128
64
32
16
8
4
2
1

Code:
public class Test{
	static int gen(int[] i,int j){
		if(j<i.length)
			return (i[j]=gen(i,j+1))*2;
		else
			return 1;
	}
	public static void main(String []args){
		int [] a=new int[10];
		gen(a,0);
		for(int i=0;i<a.length;++i)
			System.out.println(a[i]);
	}
}
 
Status
Nicht offen für weitere Antworten.

Neue Themen


Oben