當(dāng)前位置:博客首頁>>編程基礎(chǔ) >> 閱讀正文

【JAVA】初學(xué)java練習(xí)-輸出指定個數(shù)的斐波拉契數(shù)列

作者: 鄭曉 分類: 編程基礎(chǔ) 發(fā)布于: 2013-02-19 22:15 瀏覽:6,365 沒有評論


初學(xué)java的一個小練習(xí)(練習(xí)scanner、數(shù)組、循環(huán)),輸出指定個數(shù)的斐波拉契數(shù)。程序運(yùn)行時提示讓用戶輸入想計(jì)算的斐式數(shù)個數(shù),由程序計(jì)算顯示出所有數(shù)。


import java.util.Scanner;
public class hello {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
System.out.print("求幾個斐式數(shù)?");
int n = input.nextInt();
int [] fnArr = new int[n];
for(int i=0;i

? ? ? ?

本文采用知識共享署名-非商業(yè)性使用 3.0 中國大陸許可協(xié)議進(jìn)行許可,轉(zhuǎn)載時請注明出處及相應(yīng)鏈接。

本文永久鏈接: http://www.yjfs.org.cn/java-exercises-output-specified-number.html

發(fā)表評論

change vcode