#include <stdio.h>
int main() {
double a = 0.0;
double p = 0.0;
double b = 0.0;
double t = 1.0;
for (int d = 1; d <= 10; d++) {
b = 0.0; // ← これが必須
while (b < 2.0) {
p = a;
a = a + t;
b = a * a;
}
a = p; // 行き過ぎた分を戻す
t = t / 10.0;
}
printf("%.10f\n", a);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: