Mọi người xem mình sai ở chỗ nào với!Mình cảm ơn trước ạ.Đề bài: tình tổng 1/i! (i chạy từ 1)
#include<stdio.h>
#include<conio.h>
#include<math.h>
int enter()
{
int n;
do{
printf("Enter n: ");
scanf("%d",&n);
}while(n<1);
return n;
}
float sum_f(int n)
{
int i,gt=1;
float f=0;
for(i=1; i<=n; i++)
{
gt=gt*i;
f=f+1.0/gt;
}
return f;
}
main()
{
int n;
float f;
n=enter();
f=sum_f(n);
printf("Sum of part A is %f",f);
getch();
}

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?