Thứ Tư, 2 tháng 12, 2015

Bài 35: S=sqrt(1+sqrt(2+sqrt(3+...+sqrt(n))))


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <stdio.h>
#include <conio.h>
#include <math.h>

void main()
{
    float n;
    printf("\nEnter n = ");
    scanf("%f", &n);
    float S = 0;
    while(n--)
    {
        S = sqrt((n + 1) + S);
    }
    printf("\nS = %f", S);
    getch();
}
004