#include<stdio.h> int main() { float h = 100; float sum = 100; for (int i = 0; i<10; i++) { h = h / 2; sum = sum + h * 2; } printf("max=%lf \n", h); printf("sum=%lf \n", sum); return 0; } 转载于:https://blog.51cto.com/10740184/1705009