2 like 0 dislike
2.3k views
請設計一程式,使用者輸入一個正整數N,程式會輸出相對應的費氏數列第N項。

sample input:

10

sample output:

55
[Exercise] Coding (C) - asked in 作業 by (18k points)
ID: 16861 - Available when: Unlimited - Due to: Unlimited
| 2.3k views
1 2
Called for Help

44 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

#include<math.h>



int fff(int a)

{
* ** ** *** * * * ** * c[a],i;
*** ******** * ** * **** ** * * **
* * *** **** *** * *** ***
** * * ** * * **
* * ******** ** *** * * * * * * ** **** * * * **** * ******** ** ***
** * * * * * * *** *** * **** *** **** *** *** ** * **
* ** ***** * *** **
* *** * * ** *
*** ***** * * * ** * ** * c[a-1];

 }

 int main()

 {
** ***** *** * ** ** * ** a,b;
** ** ****** * **** ** ** ****** * **** * ** **
** * * *** * ** * *
* * * * ** * * * *** ** * ** ** * *
* *** ***** * *** * **** ***
** * **** *** ** * * *** ** **********
** * * *** **** ** *** * 0;
* *** ** ***** ** *****

 }
answered by (-124 points)
0 like 0 dislike
Hidden content!
#include ** * ** * *

#include * ** * * * *** **



int fibonnacci(int number)

{
*** * ** i = 1, num1 = 1, num2 = 1, fibon = 0;

  
*** *** ** (number <= 0)
** ** ** * ** * * *** *** *** * not exist");
* * **** * ** if ((number == 1)||(number == 2))
** * * ** * **** * 1;
** * *
** * * **
** ** * * ** ** * * *** * * * *** = 3; i <= number; i++)
** *** **** * *** ***** **
* * * ** * * * * * * **** * * * * * *** = num1 + num2;
* **** * * ** **** * * *** *** ** * * * * = num2;
* * ********** * * * ** *** ** **** * * * = fibon;
****** * * ***** * * ** **** *** ***
* * ** * * **** *******
* * **
*** *** * ** * * * fibon;

}

int main()

{
***** * ** **** * num, fibonnum;
* * ** * * *
* * *** ** **** * *** * *** * * *** * ** *
** * * ****** * * * * = fibonnacci(num);
* * * ****** * ** **** * ** **
* **** * * *****
** ****** * * * * ** ** ** * * * * *
** ** ** * * * *
* **** ******* * *** * * 0;
* * * * ** * * ***

}
answered by (102 points)
0 like 0 dislike
Hidden content!
** *** * ** **
* * * **



int * ** ****** number)



{

int ** * ** * * *


* ** **** * <=0)
* * ** ** *** *** ***** ** * *


* * * ** ** * * ** ** ** * * ****
* * * ** * 1 ;


** ***** *** *
** **** ** *
* * * * * ** ** * * **

{


* * * **** ***
* * ** ****** * **
*** * ** ** *

}

}
* * * * ***** fibon;






** ** * * * *

int main()

{

int ** **** *


** *** **** ** *** *



fibonNum = * **** *
*** ** * ** **













}
answered by (-383 points)
0 like 0 dislike
Hidden content!
* ** *** * ** ** *
* *** ** * * * **
* * * ** * **



int fibonacci (int number)

{


*** ** ** ** num1=1,num2=1 ,i ,fibon = 0;
***** * ** * *** * ***** * **
**** **** ** *** *
*** * *** ** * * ******** *** input positive number ");


* *** * * ** ** ** *** * *** * *** 0;
* * **


* ** * * * ** **** * if((number == 1)||(number == 2))
**** *** ** **** * ** ******* ****** * ** ** 1;


*** ** ** ** * * *
* * * ** *** * ****
** * *** * *** ** * * *** *** * =3; i <= number; i++)
** * * * ** ** ** **** ****
* * *** ** * ****** *** ** ** * * = num1 + num2;
** ** * ** ****** * * ***** * * =num2;
*** ** **** * ** * ** ********* ** ** ** = fibon;


** ****** ** * ** * * * **
*** ***** **
* ** * * *** * * ** fibon;

}



int main()

{
* * * ** * * ** num,fibonNum;


* **** ** ** * ** * * *


*** * ****** *** * * * = fibonacci(num);
** * * * * * ** **** ** ** *


* ****** * *** * * ****** ** * *
* * * * ** ** * * * 0 ;





}
answered by (-72 points)
0 like 0 dislike
Hidden content!
#include ** **** *

#include * * ** * *** **





int fibonacci(int number)

{
**** * ** * i, num1 = 1, num2 = 1, fibon = 0;
* ** * * * * * * *
** *** **** ** (number <= 0)
*** *** ** ****
*** *** ** * * * * * *** ** * * *** * input positive ** ** * ** *
***** ***** * * * * * ******* * * ** *** 0;
* ** *** ******** * ** * ****
** **** ** ** if ((number == 1) || (number == 2)

* ** **** *** * * * ** ** * * * ** * 1;
** * * *** *******
** * *** * ** * *
** * *** * ***** * ** ** * ***** (i = 3; i <+number; i++)
** *** ** * * *** **** **
*** *** * * ** * * ** ** * ** * **** ** * ** ** ** = num1 + num2;
**** *** **** * * * * * ** * * ** * * * = num2;
* ** * *** * ** ** ** ** * **** * ** ** = fibon;
**** **** ** *** * ** * **** *
* *** * **
** ******* ***** * **** fibon;



}

int main()

{
** * * ***** * num, fibonNum;
*** *** *** ** * * *
* * * * * ** * = fibonacci(num);
**** ** *** * ** ** ** * **** fibonNum);
** * ** * * *** * **
* ** ** * * * * * * * **** *** * * **
** ****** * * * * ** * 0;

}
answered by (-74 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>
****** ** * ** *
** **** ** **** **



int fff(int num)

{
** **** ** * ***** j,k=1,sum=1,i=1;
*** *** * ** ** * ***
** * ** **** *** * * ***** 1;
*** * * * ** ** **** **
*** * * * * * *
** * * * * *** **** * * *** * ****
*** *** ** * ** ** * *
**** ** ** * * * * *
** * *** * * ** ** ** *
*** **** *** * ** *** ** *

}
* ** ** **** * ** *** * * ** *** * * ** * *
**** ****** ** *** ** * sum;
** * *** * * * ** *

int main()

{

 int ans,n;
* * * * * * *** *** *** *** ** *

 ans=fff(n);
** * ** *** * ***

return 0;   
* ***** * **** ** *
answered by (-122 points)
0 like 0 dislike
Hidden content!
** ** * * ** *
** ** * * ****
** * ** *


** QQ()

{
*** * * * **** ** num, sum = 1, i, a1 = 1, a2 = 1;
** * * ** * * * **** * * *
*** ** * ** ** * == 1 || num == 2)
* ***** * **** ** * * * ** = 1;
* * **** * *** ** *
******** **




* * ****** ** ** (i = 3; i * num; *
*** *** **
** * * *** ** * ** = a1 + a2;
* ** * *** * = a2;
* * *** * * **** = sum;
** * * * * * *

}




** * * * * * ** ** ** * *

}

int *

{
** *** ** *

}
answered by (46 points)
0 like 0 dislike
Hidden content!
* * ** ** * * * *
* *** * * ** * **
* * ****** * * ** *

void **** ****** number)

{

int **** *


* * * ***** *** *
*


**** * ***** * *** * *** * * **

}







int main()

{
* *** ** * ** ***** * base;


** *** * **** ** ** ** ****** ***** **


* * ** *** * * *** *















}
answered by (54 points)
0 like 0 dislike
Hidden content!
* * **** *
* ** **** **

#include<math.h>



int fibonacci(int number)

{
* ** * * * ****** ** i, num1=1, num2=1, fibon=0;
** * * * * ****** ******
******** **** *
** **** ** *** * * ** *** input positive number");
*** ** * ** * * * ** ** * * * 0;
* * ** ** * *
* ** * * *** *** if ((number==1)||(number==2))
* ** ** * ** ** * ** * ** 1;
* * * ** *** ***


* ** *** * ** * ** * * * ** ****** ** i<=number; i++)
* ** ***** * * *** * ***** ** **
******* ** * *** *** ** ** *** * * * ** * num1+num2;
**** ***** ** ** *** * ** ***** *** **** **** ** * **
** ** ** * ** * * * ** * ** * ** *** * *** ** **** *** * *
* * * * ** ** *** *** *** *

return fibon;
* ******* * * *





int main()

{
* *** * * * * num, fibonNum;
** * ****** ** ***** * ** **** &num );
** * * * *** * * ** * ** ** *
* *** * * ** * * * * *** * * * fibonNum);
***** * ** * * * *** * ******* * *
** * *** * ** *** 0;

}
answered by (-40 points)
0 like 0 dislike
Hidden content!
# include * ** **** *****

# include * * * * * *

# include <math.h>



int bd(int number)

{
* ** * **** **** ** i, num1 = 1, num2 = 1, fi = 0;


*** * * **** * (number <= 0)
* * * * ** *** * * *** ******* **
** * ****** ****** * *** * * ****** * **** * ** * *** ** * *** *** * * *
* ** ** * *** ** * * *** * * * * * * ***** * * * * 0;
*** * * *** * * ** * * *** ** * *
*** * * **** * * if ((number == 1)||(number == 2))
** *** * ** * ** * 1;
** * * **** * * ** * * *
*** * * * **** *** *** * **




* ***** * *** * *** *** (i = 3;i <=number; i++)
* *** ** * **
** * *** *** * **** ***** ** ** * * = num1 + num2;
* * *** * * ** ** * ****** ** * *** * = num2;
*** ***** ** ** *** *** * ***** ** * *** * ** * * * ** = fi;
* * *** **** *
* **** ** * ** * * ** ***

return fi;

}



int main()

{
** ** ** * ** * *** num,fibonnum;


** * ** ** * ** * * * *** ** * &num);
** * ** * * * ** * *** * = bd(num);
* * * * ** * * **** *** *** ** * ** ** fibonnum);


* *** ** ** *** * * *** * *** **** **
**** * * **** ** * * 0;

}
answered by (-42 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.71.254.54
©2016-2024

Related questions

1 like 0 dislike
48 answers
[Exercise] Essay (Open question) - asked Nov 2, 2016 in 作業 by Shun-Po (18k points)
ID: 16865 - Available when: Unlimited - Due to: Unlimited
| 2.6k views
1 like 0 dislike
129 answers
[Exercise] Coding (C) - asked Oct 19, 2016 in 作業 by Shun-Po (18k points)
ID: 14119 - Available when: Unlimited - Due to: Unlimited
| 5.1k views
0 like 0 dislike
117 answers
[Exercise] Coding (C) - asked Oct 13, 2016 in 作業 by Shun-Po (18k points)
ID: 13581 - Available when: Unlimited - Due to: Unlimited
| 4.7k views
0 like 0 dislike
131 answers
[Exercise] Coding (C) - asked Oct 5, 2016 in 作業 by Shun-Po (18k points)
ID: 12291 - Available when: Unlimited - Due to: Unlimited
| 5.4k views
0 like 0 dislike
121 answers
[Exercise] Essay (Open question) - asked Sep 21, 2016 in 作業 by Shun-Po (18k points)
ID: 11340 - Available when: Unlimited - Due to: Unlimited
| 5.2k views
12,783 questions
183,443 answers
172,219 comments
4,824 users