เตรียมRecord Code java-- public class Recursion { - TopicsExpress



          

เตรียมRecord Code java-- public class Recursion { public static int sum(int x){ if (x==0) return 0; return sum(x-1)+x; } public static int Fact(int y){ if (y==1||y==1) return 1; return Fact(y-1)*y; } public static int fab(int x){ int fn=0; if (x==0)return 0; if (x==1)return 1; int p =1; int b=1; int sum=0; for (int i = 0 ; i < x; i++) { sum=p+b; p=b; b=sum; } return sum; } public static int fab2(int x){ if (x==0) return 0; if (x==1||x==2) return 1; return fab2(x-2)+fab2(x-1); } public static void main(String[] args) { /*for (int i = 1; i
Posted on: Mon, 01 Jul 2013 11:56:40 +0000

Trending Topics



Recently Viewed Topics




© 2015