#include <stdio.h> int main() { float a=2.0,b=1.0,c,sum=0; int n; scanf("%d",&n); while (n--) { sum+=a/b; t=a; a=a+b; b=t; } printf("%.6f",sum); } /* Main.c: In function 'main': Main.c:10:12: error: 't' undeclared (first use in this function) t=a; ^ Main.c:10:12: note: each undeclared identifier is reported only once for each function it appears in Main.c:4:20: warning: unused variable 'c' [-Wunused-variable] float a=2.0,b=1.0,c,sum=0; ^ */ |
Double click to view unformatted code.