求c语言1^1+2^2+3^3+...+n^n 回圈计算

2024-12-14 08:53:44
推荐回答(1个)
回答1:

#include
main () {
int n, s = 0;

scanf ("%d", &n);

for (int i = 1; i <= n; i++) {
s += pow (i, i);

}

printf ("%d\n", s);

}