#include <stdio.h> #include <math.h>

int main() { double sum = 0.0; int n = 1; while (1) { double term = 1.0 / (n * n + 1); sum += term; if (term < pow(10, -6)) { break; } n++; } printf("The sum is: %lf", sum); return 0; }

设计算法并编写程序计算11^2+1+12^2+1+13^2+1+14^2+1+…+1n^2+1直到最后项小于10^-6。使用c语言

原文地址: http://www.cveoy.top/t/topic/dwl7 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录