求斐波那契数列前15项和并打印出其中的奇数之和>
#include <stdio.h>
int main()
{
int fib[15];
int i,s=0;
fib[1]=1;
fib[0]=1;
for(i=0;i<15;i++){
fib[i+2]=fib[i]+fib[1+i];
printf("%d ",fib[i]);}
for(int j=0;j<15;j++){
if(fib[j]%2!=0){
s=s+fib[j];
}
}
printf("\n%d\n",s);
return 0;
}
标签:并打印,15,数列,int,fib,Fibonacci
From: https://www.cnblogs.com/JK8395/p/16816505.html