| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
 Reworld，下班在家制作游戏，1500万奖金等你拿 以码会友 以友辅仁

已结贴   问题点数：20  回复次数：1

#include<stdio.h>
int main()
{
int a=1,b=1;
int m,n;
int i;
printf("请输入项数：\n");
scanf("%d",&m);
if(m%2==0)
{
n=m/2;
for(i=0;i<n;i++)
{
printf("%d %d ",a,b);
a=a+b;
b=a+b;
}
}
else
{
n=m/2;
for(i=0;i<n;i++)
{
printf("%d %d ",a,b);
a=a+b;
b=a+b;
}
printf("%d",a);
}
return 0;

}

得分:20

#include<stdio.h>
int main()
{
double a=1,b=1;
int m,n;
int i;
printf("请输入项数：\n");
scanf("%d",&m);
if(m%2==0)
{
n=m/2;
for(i=0;i<n;i++)
{
printf("%25.0lf %25.0lf \n",a,b);
a=a+b;
b=a+b;
}
}
else
{
n=m/2;
for(i=0;i<n;i++)
{
printf("%25.0lf %25.0lf \n",a,b);
a=a+b;
b=a+b;
}
printf("%25.0lf",a);
}
return 0;

}
}

47
1                         1
2                         3
5                         8
13                        21
34                        55
89                       144
233                       377
610                       987
1597                      2584
4181                      6765
10946                     17711
28657                     46368
75025                    121393
196418                    317811
514229                    832040
1346269                   2178309
3524578                   5702887
9227465                  14930352
24157817                  39088169
63245986                 102334155
165580141                 267914296
433494437                 701408733
1134903170                1836311903
2971215073

[此贴子已经被作者于2019-6-9 20:37编辑过]

• 2
• 1/1页
• 1