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

 
Hướng dẫn tạo blog trong Symfony 2 framework

Hướng dẫn tạo blog trong Symfony 2 framework

This tutorial will guide you through the process of creating a full featured blogging website using Symfony2. The Standard Distribution of the Symfony2 framework will be used

How to fix Drupalgeddon2 vulnerability (CVE-2018-7600) in Drupal 7.x and 8.x

How to fix Drupalgeddon2 vulnerability (CVE-2018-7600) in Drupal 7.x and 8.x

We found many of these sites with malware uploaded into them, and malicious processes running off it (backdoors, crypto currency miners, etc.).

Content

Bài 4: Nội dung website phải chất lượng

Bạn thường nghe nói rằng nội dung tốt là vua( content is King), có nghĩa rằng khi website của bạn có nội dung tốt, thì sẽ có thứ hạng cao trên bô máy tìm kiếm.

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

 

Diet con trung