回覆列表
  • 1 # 火奇飛

    #include<stdio.h>

    int main()

    {

    int n,i,un1,un2,un;

    for(n=2;n<3;)

    {

    printf("please enter required number of generation:");

    scanf("%d",&n);

    if(n<3) printf("\n enter error!\n"); /*控制輸入正確的n值*/

    }

    un=un2=1;

    printf("the repid increase of rabbits in first %d generation is as felow:\n",n);

    printf("l\tl\t");

    for(i=3;i<=n;i++)

    {

    un1=un2;

    un2=un;

    un=un1+un2; /*利用通項公式求解n項的值*/

    printf(i%10?"%d\t":"%d\n",un);

    }

    printf("\n");

    }

  • 中秋節和大豐收的關聯?
  • 維生素E不能和什麼東西一起吃?