2006-11-06

第六次作業

1.
import java.io.*;
public class Untitled1
{public static void main(String[] args)throws IOException
{
int x,n,i;
double c,d,sum=1;
String a,b;
BufferedReader keyboard= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter x of exp(x)");
a=keyboard.readLine();
x=Integer.parseInt(a);
System.out.println("Please enter n of n!");
b=keyboard.readLine();
n=Integer.parseInt(b);
c=d=1;
for(i=1;i<=n;i++) { c*=x; d*=i; sum+=(c/d); } System.out.println("The sum of exp(x)= "+sum); } }






























2.List 5 examples of Fibonacci numbers in nature.
1.兔,牛與蜂的家庭樹
2.Fibonacci Rectangles and Shell Spirals
3.花瓣
4.種子
5.松毬果

0 Comments:

Post a Comment

<< Home