import java.util.Scanner;
public class Homework0407
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner (System.in);
System.out.println("Enter the limit number:");
float first,second,temp,max,per;
first=1;
second=1;
max=keyboard.nextInt();
while(second<=max)
{
per=second/first;
System.out.println(second+"/"+first+"="+per);
temp=first+second;
first=second;
second=temp;
}
}
}
結果:
沒有留言:
張貼留言