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

sample input:

10

sample output:

55
[Exercise] Coding (C) - asked in 作業 by (18k points)
ID: 16957 - Available when: Unlimited - Due to: Unlimited
| 679 views

26 Answers

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

#include <stdlib.h>

#include <math.h>

int main(void) {
* *** * * *** *** **** * a[99],i,x;
** ** * * * * * ****** ***** ** *** ** ** ***
* ***** **** ** * * *** * *
*** * * * * ** ** *
* * * * ***** **** * ** ** ** *
*** * * * * * * **
*** *** * * * ** * * * * * * *** * * ** ** ** *** **** * * **** ** * * ** ** ** *
** **** **** * **** *
* * * * ** ** * * * ***** * * * ***
** * * ** * * * * EXIT_SUCCESS;

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

#include <stdlib.h>

int Fibonacci(int n);

int main()

{
***** * * *** * *** ** ** i,n,f;
* * *** * * ***** ** * * * ** * ** ****** *** * * *** *
* * * * * ** ** * * ** * * * * &n);
* ** ** **** * **** * Fibonacci(n);
* * *** * *** ****** * ** * f);
* * ** **** **** * * ** ***** **** * * *
***** * * * * ** * *** * * * ** * * *
** * ** ** ************* * 0;

}



int Fibonacci(int n)

{
* ** * * * ** * ** f;
** ***** *** *** *** *** ***
* * * * * ** * ** * * ** ****** ****
* * * * ** ** ** if(n==1)
* *** ** * * * **** ** * ** * ** * ***
*** *** **** * ***** if (n>=2)
* * ** * **** * **** **** * ** * ** * **
* ****** * * ** *** * * f;

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

long n)

{
*** a1=0, a2=1, a3=1, i;
** ** ** * ** * 1;
**** ** * i++) {
** * ** * ** * **
** * * ** * * ***
** ***** * ** ** * *
* * *
** ** ** a3;

}

void main()

{
** * n;
* * * ** * ** ** * *** *
******* *** ** ** *** * ***

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

#include<stdlib.h>



int fibona(int number);



int main()



{   int num,fib;
** *** ****** * *
* * *** ** * * ** *** * * ** * * * *** **
* *** * ** * ** ** ** * * = fibona(num);
**** * * * ***** * ***** ******* ***** *
* * * * * * * *** ** ** ** * *** ** **
*** * * *** **** * * * * 0;

}

   int fibona(int number)   

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

** ** ** * * *** **** * *** ** * * * *** *** * * * *** inout a positive number!");
***** * *** * ** ** **** ** ** **** 0;
** *** * ** *** ** ** * * ******* * ****
* * ** ** * * **** * * * * ***
* ** * ** ****** * ** * *** ** * **** if ((number == 1) || (number == 2))
*** ** ***** ** * ** ** ** ***** ****** 1;
****** ** ** *** * * ** * * * * ** *** **
**** **** * * ** *** * *
******* ** ** **** * ** ** **** **** * *

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

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

#include <stdlib.h>





int fibric(int n)

{



 int last2=1,last1=1,f=0,i;

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

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

 else

 {
* ***** * * ** ** ** **** * **** ** * *
** ** ** * * * *** ***
*** ** ******* ***** * **** * *
* ** **** **** *** ***** **
*** *** * ****** * * *** * *** ** ** * *
*** **** ** *** *** *** * *

 }
* * * **** **** * ***
* * ** *** * * ** * * *** *
**** * ** * * *** ** * * ****** f;

}



int main()

{
* * **** * * * * * a,fab;
* * * * ** *** * * * ** * * ** * *** *
** ** ** * ****
** ****** *** * *** ******* *** * * **
*** * * ** ** ******* *** **** **** **** ** * * **
* ** * * * ** * * *** * ** *
*** * * * **** * * *** *** * ** * ** * * * ** *** *
* * *** * * ** ****** ** ** 0;
* * * ** * * * *****

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

int fun(int num){

  int n;
****** *** || n==2)
* * * * * * * ** **** * ***

 else{
**** * ** ** ** * i,last1=1,last2=1,sum=0;
* *** ** *** *** * * ***
* * **** *** * * *
** ** * ** * ** *** *
* * ***** * ** ****
** ** * * ***
* ** * **** * *** * ** ******
**** *

}

int main(){
* ** * ****** * * ** num=0;
** * ** * ** * ***** ** * ** * ** * ** * * *
* * * ******* **** * **** *
**** ** ** * ** * ** **** * 0;







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

#include<stdlib.h>

int ffff(int num)

{
* ****** ** ****** * * ** num1=1,num2=1,b,c=0;
** * ****** ******** ** ** ** ** * **
* * * * ***** * ** * ***** * * * ** * ******
** ** * * ** ** * ** * * ** ** ** *****
* ** * ** ** ** * * * * * * * *** ***** *** * *
* * * * * * ** * ***** **** *** *** **
** * ** * ** * *** * * * * ***** ** *
* ** * ** * *
* * * * ** **** * **

int main()

{
****** * * *** ** * **
** * * *** **** *** *** * num=0;
** * * * *** * * *** ***** * ** ** ** * * * * *
* * ** ** * ** * * ***
** ** * *** * * ** ** *** * * * ***
** ** * ***** * ** 0;
* ** ** * *** ** * * *** *

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

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

#include<stdlib.h>

#include<math.h>



int main()

{

      
** ** * * *** ****** * **** i , a ;
* ** * ** * **** ** * * ** * s[100]={0};
* **** * ** * ******** * * * * ** ** last1 , last2 ;
* *** * **** *** ** * * *
* ** * * * ***** * * **** *** **** , &a);

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

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

      

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

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

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

#include<stdlib.h>



void A(int j)

{
*** **** * *** ** * * * * A[j],i;
* ** *** *** * * * * ** * * *
**** **** * ** * * ** *
** * * *** * * * * **** * ****** ** *** *
* * **** * *** ** ** ** ** * * *
* * ** * ** **** *** ** * * *** * *** * **** *
**** * * *** * * *** * *
** ** * ** * * ** *** ** * *
* * ** * * ** * **** * * * * *** * * A[j-1]+A[j-2];
* ** * * ** * ** *** ***** ********* *** ****

}



int main()

{

    int i;
* * * ** * *** * ** * *** ** * * *
** *** * *** * ** ** *** * * *
**** * * * * * *** *** * ** * **** * ** *
** ** ** ** ** **** ** * 0;

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

#include<stdlib.h>

#include<math.h>



int main()

{

      
* * ****** ** *** ** * ** * * * *** i , a ;
** * * ** ** * * * * *** ** * ** s[100]={0};
** * ** *** * * * last1 , last2 ;
*** ** ** * ******** ** ***** * *
* **** ** * ** * ** ****** ***** ** * ****** * *** ****** , &a);

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

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

      

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

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

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

Related questions

0 like 0 dislike
31 answers
[Exercise] Essay (Open question) - asked Nov 3, 2016 in 作業 by Shun-Po (18k points)
ID: 16958 - Available when: Unlimited - Due to: Unlimited
| 804 views
0 like 0 dislike
37 answers
[Exercise] Coding (C) - asked Oct 20, 2016 in 作業 by Shun-Po (18k points)
ID: 14579 - Available when: Unlimited - Due to: Unlimited
| 852 views
0 like 0 dislike
67 answers
[Exercise] Coding (C) - asked Oct 13, 2016 in 作業 by Shun-Po (18k points)
ID: 13427 - Available when: Unlimited - Due to: Unlimited
| 1.3k views
0 like 0 dislike
73 answers
[Exercise] Coding (C) - asked Sep 29, 2016 in 作業 by Shun-Po (18k points)
ID: 11603 - Available when: Unlimited - Due to: Unlimited
| 1.5k views
0 like 0 dislike
66 answers
[Exercise] Essay (Open question) - asked Sep 22, 2016 in 作業 by Shun-Po (18k points)
ID: 11532 - Available when: Unlimited - Due to: Unlimited
| 1.4k views
12,783 questions
183,443 answers
172,219 comments
4,824 users