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

Bài 34: Tính S(n) = CanBac2(n+CanBac2(n – 1 + CanBac2( n – 2 + … + CanBac2(2 + CanBac2(1) 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)

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

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

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);

    i = 1;
    S = 0;

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

    getch();
    return 0;
}
Bạn thấy bài viết này như thế nào?: 
Average: 3.9 (59 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

 
Phần 3 viết Drupal 8 Module: Configuration Management and the Service Container

Phần 3 viết Drupal 8 Module: Configuration Management and the Service Container

In this tutorial, I will continue where we left off. I will illustrate how we can turn our into a form used to store a value through the Drupal 8 configuration system

Kindle Fire

Kindle Fire HD - Bước bước đột phá so với phiên bản tiền nhiệm

Kindle Fire HD 7 inch được xem là bước đột phá so với phiên bản tiền nhiệm, mang đến một số cải tiến về công nghệ cũng như được thiết kế hướng đến bất kì đối tượng nào.

Phần 1: Apache Solr - Hướng dẫn Creating Custom Fields

This is the first of two blog posts. In this one I will show you how to create a custom search index in Apache Solr

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

 

Diet con trung