View Code of Problem 48

#include<stdio.h>
int main(){
    int a=2,b=1,c,n,i;
 double s=0;
 scanf("%d",&n);
 if(n>10||n<1)return 0;
 for (i=1;i<=n;i ++)
 {	s+=(1.0*a/b); 
	 c=b;
	 b=a;
	 a=a+c;
 }
 printf("%.6f\n",s);
 return 0;
 }
/*
Main.c: In function 'main':
Main.c:16:2: error: stray '\357' in program
  }
  ^
Main.c:16:2: error: stray '\275' in program
Main.c:16:2: error: stray '\235' in program
Main.c:16:2: error: expected declaration or statement at end of input
*/

Double click to view unformatted code.


Back to problem 48