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

 
Amazon gỡ bỏ quyền root dành cho người dùng Kindle Fire

Amazon gỡ bỏ quyền root dành cho người dùng Kindle Fire

Bản cập nhật phần mềm 6.2 mới cho Kindle Fire gỡ bỏ quyền truy cập root dành cho người dùng, tuy nhiên người dùng vẫn có thể tiến hành root lại

Adding a Slideshow to Drupal

Thêm 1 Slideshow cho Drupal site như thế nào?

This week's tutorial was requested by a student in our Drupal forum. They wanted to know how to add a slideshow to their Drupal site.

Sử dụng parallel processing để tiết kiệm time importing databases

Sử dụng parallel processing để tiết kiệm time importing databases

In this article I'll walk through the troubleshooting process I used to improve things, and the approaches I tried

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

 

Diet con trung