Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Tinh S(n)=sqrt (2+sqrt (2+sqrt (2+ sqrt (2+.............sqrt(2)).....)))
- có n dau can.
- */
- // Khai bao cac ham thu vien neu cos
- #include<stdio.h>
- #include<conio.h>
- #include<math.h> // thu vien cho sqrt, abs,...
- void main()
- {
- int n;
- scanf("%d",&n);
- double s=0;
- for(int i=1;i<=n;i++)
- {
- s=sqrt(2+s);
- }
- printf("%.4lf\n",s);// Lay 4 chu so sau dau thap phan
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement