Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<conio.h>
- #include<math.h>
- double f(double x,int k);
- main()
- {
- float x,s=0;
- int k,n;
- printf("nhap vao so x ");
- scanf("%f",&x);
- printf("nhap vao n= ");
- scanf("%d",&n);
- for (k=1;k<=n;k++)
- s+=f(x,k);
- printf("\n gia tri cua bieu thuc %lf",s);
- }
- double f(double x,int k)
- {
- double s=x;
- if(k==0)
- s=x;
- else
- s=pow(x,k)/k;
- k++;
- return s;
- }
Advertisement
Add Comment
Please, Sign In to add comment