1+1+2+3+5,,,,,,,,帮我看看错哪了!!
main(){
int i,n,f1=1,f2=1,f3;
printf("please input value:");
scanf("%d",n);
for(i=3;i<=n;i++)
f3=f1+f2;
f1=f2;
f2=f3;
printf("the n is:%d\n",f3);
}求第N项的数,1 1 2 3 5 8 13 21 34 56.........前2项之和等于第N项的数
#include <stdio.h> #include <stdlib.h> int main() { unsigned long i,n,f1=1,f2=1,f3; printf("please input value:"); scanf("%d",&n); for (i=3;i<=n;i++) { f3=f1+f2; f1=f2; f2=f3; } printf("the n is:%d\n",f3); system("pause"); }试一下这个