#include <stdio.h> int main() { double h = 100.0, sum =0; for (int i = 1; i <=10; i++) { if (i <= 9) { sum += h + h / 2; h = h / 2; } if (i == 10) { h = h / 2; sum = sum + h*2; } } printf("%lf\n", sum); printf("%lf", h); return 0; }
#include <stdio.h> int main() { double h = 100.0, sum =0; for (int i = 1; i <=10; i++) { if (i <= 9) { sum += h + h / 2; h = h / 2; } if (i == 10) { h = h / 2; sum = sum + h*2; } } printf("%lf\n", sum); printf("%lf", h); return 0; }