Generation

generate functionFri, 23 Dec 2022

以下のsが1000を超えるときのsとnの値を表示せよ。 𝑠=n∑i=1(i^2/(1+i^2))

#include <stdio.h> int main(void) { int n = 1; double s = 0; while(s < 1000) { n++; s += n; s += 1/(n*n); } printf("%d %lf\n", n, s); return 0; }

Questions about programming?Chat with your personal AI assistant