代码文本:
#include "stdio.h"
int main(int argc,char *argv[]){
int N,i,a,b;
double s,t;
printf("Enter N(int N>0)...\nN=");
if(scanf("%d",&N)==1 && N>0){
for(a=2,b=1,s=i=0;i s+=a/(b+0.0),a+=b,b=a-b; printf("s(%d)≈%.4f\n",N,s); } else printf("Input error, exit...\n"); return 0; }