0 like 0 dislike

In mathematics, the Fibonacci numbers or Fibonacci sequence are the numbers in the following integer sequence: 0,1,1,2,3,5,8,13,21,34,55,89,144

By definition, the first two numbers in the Fibonacci sequence is 0 and 1, and each subsequent number is the sum of the previous two. In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the relation Fn = Fn-1 + Fn-2 with seed values F0 = 0, F1= 1

Write a program that asks the user to type an integer n, then display Fn on the screen.

Example input 1:

``5``

Example output 1:

``5``

Example input 2:

``12``

Example output 2:

``144``

edited | 731 views

0 like 0 dislike
`Hidden content!#include <stdio.h>int main(){    int a,i=0,j=1,k,c=2;   ***  ***   **  * ***   **  ** ** * *  **   ***  **   * ***  *** *  * * * ** ** **  ****  *  *  ** *  * *  * ** ***** * ** *  *   **   *      **  * * ** ***   *  ** *  *** **     *      **   ****   ***  *    * * *       **   *  ******  * *  ** **** **  ***   *   * ** ****  *   *  *    ** * *  *     *    **  * ",k);*  * * *  ***  *  *   * *  *  **   *** *** *  *** * *        *  *  **  * * * ** ******* **    *   *** ****** * ***** *  ** **  **** ** ***** *********     *  * *  ** ***  ** **      *  ****** *  *****  *  **      * ***  ** * *    ****  **   ** **        ***** ** *** ** * ****  * ****    * ***** ****   ***** *****   **   * **** *  *   ** * **  **   *   ******* *    }    return 0;}`
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
`Hidden content!#include<stdio.h>int Fibonacci(int i);int main(){  * * **      * * * *  *     a;    *** ** * *  *  **     * ** **   ** *      * ** *      **** ** ***  **  *  ** * * * * * ******  **  *   ** **         *   *        *  ** ** 0;}int Fibonacci(int i){*  * *     * *   ****   == 0){** ** **** * ****       *  *  ** * *  *** *   * ****  0;* **   *  * * * * ***   ** ** * * *  * * *    **     * **  * * if(i==1){   * * ** ***    *** ***  ***  * ** *   * ***** * * * * 1;* *   ******* **   **   *   ** * * * * *   **  ****  * **  * * * ** ** *   ** * *  * **** *   *  ** ** **  *  **  ** * Fibonacci(i-1)+Fibonacci(i-2); *     **  ***  * **  * *  }`
`Hidden content!#include     *  *** ***#include ****** ** ** *** int main(){***** *    **** **** ** ** *   * * num[100] = { 0 }, n;* * ******  *  * * *    ***     i; * * ** ***     ** *  **  ***  ***   ****** ****    ** *  **   *****  *  * * ** *    **      = 1; **** *** * * *******   *** * ( i = 2; i * * *  n; i++) *   * **    * *** ** **  ***** ***** ******** * **  * **    ********    **  ******   * = num[i - 1] + num[i - 2]; ** ****  * **** * ****   *  * *  * ****   ** *** * *******  * * *** **** num[i - 1]);*  *** * *  * *****    **  *    0;}`