View Code of Problem 48

#include<stdio.h>
#include<math.h>
int main()
{
  int i,n,a=2,b=1;
  double sum=0.0;
  for(i=0;i<n;i++)
  {
    sum+=a/b;
    c=a+b;
    b=a;
    a=c;
  }
  printf("%.6f",sum);
  return 0;
}
/*
Main.c: In function 'main':
Main.c:10:5: error: 'c' undeclared (first use in this function)
     c=a+b;
     ^
Main.c:10:5: note: each undeclared identifier is reported only once for each function it appears in
*/

Double click to view unformatted code.


Back to problem 48