Tính tổng

#include <stdio.h>
#include <math.h>
int main()
{
int i, n;
float s = 0;
printf("Nhap n: ");
printf("%d", &n);
for (i = 1; i <= n; i++)
{
s = s + 1/(i *i);
}
printf("Ket qua: %f", s);
return 0;
}
Output
Nhap n: 1
Ket qua: 1.000000
-------------------------------
Process exited after 4.729 seconds with return value 0
Press any key to continue...
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?