Bài 33: Tính S(n) = CanBac2(2+CanBac2(2+….+CanBac2(2 + CanBac2(2)))) có n dấu căn

Bài 33: Tính S(n) = CanBac2(2+CanBac2(2+….+CanBac2(2 + CanBac2(2)))) có n dấu căn

Bài tập 33 (Dạng bài tập này giúp các bạn giỏi về: Lưu đồ thuật toán)

Tính S(n) = CanBac2(2+CanBac2(2+….+CanBac2(2 + CanBac2(2)))) có n dấu căn

S(n) = 2 + 2 + 2 + ... + 2 + 2

Cài đặt

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
    int i, n;
    float S;
    do
    {
        printf("\nNhap n(n >= 1): ");
        scanf("%d", &n);

        if(n < 1)
        {
            printf("\nn phai >= 1. Xin nhap lai !");
        }
    }while(n < 1);

    S = sqrt((float)2);
    for(i = 2; i <= n; i++)
    {
        S = sqrt(2 + S);
    }
    printf("\nTong S = %f", S);

    getch();
    return 0;
}
Bạn thấy bài viết này như thế nào?: 
Average: 10 (3 votes)
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
7 điều thú vị từ DrupalCon Sydney

7 điều thú vị từ DrupalCon Sydney

At the beginning of February, Australia held the first ever DrupalCon outside of Europe or North America.

So sánh Social Business Platforms: Part 3 - Drupal Commons

So sánh Social Business Platforms: Part 3 - Drupal Commons

In our first two posts we reviewed two of the most popular platforms for social business portals, Jive and Sharepoint.

Sự khác biệt giữa hosting Linux và Windows

Sự khác biệt giữa hosting Linux và Windows

Trước đây, giữa hosting (dịch vụ lưu trữ) Linux và Windows luôn có một sự khác biệt rất lớn.

Công ty diệt chuột T&C

 

Diet con trung