Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Khai bao cac ham thu vien neu co
- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- int n;
- float x;
- scanf("%d",&n);
- scanf("%f",&x);
- long double t=(x*x) +x +1;
- long double m=(x*x) - x +1;
- long double k=1;
- long double p=1;
- long double s=0;
- if(n==0)
- {
- printf("2");
- }
- else
- {
- for(int i=1;i<=n;i++)
- {
- k=k*t;
- p=p*m;
- s=s+ p +k;
- }
- printf("%.4lf",s);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement