#include <stdio.h> int main() { double a = 2.0, b = 1.0; double n, sum = 0.0,t; int i; for (i = 1; i <=20; i++) { n = a / b; t = a; a = a + b; b = t; sum = sum + n; } printf("%.10lf", sum); return 0; }
#include <stdio.h> int main() { double a = 2.0, b = 1.0; double n, sum = 0.0,t; int i; for (i = 1; i <=20; i++) { n = a / b; t = a; a = a + b; b = t; sum = sum + n; } printf("%.10lf", sum); return 0; }