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

Bài 36: 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 36 (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(n! + CanBac2((n-1)! +CanBac2((n – 2)! + … + CanBac2(2!) + CanBac2(1!)))) có n dấu căn

S(n) = \sqrt{n! + \sqrt{(n-1)! + \sqrt{(n - 2)! + ... + \sqrt{2! + \sqrt{1!}}}}}

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, M;
    do
    {
        printf("\nNhap n(n >= 1): ");
        scanf("%d", &n);

        if(n < 1)
        {
            printf("\nn phai >= 1. Xin nhap lai !");
        }
    }while(n < 1);
    i = 1;
    M = 1;
    S = sqrt((float)0);

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

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

 
Giới thiệu the state of ReST API trong Headless Drupal 8

Giới thiệu the state of ReST API trong Headless Drupal 8

This allows you to use all the Drupal 8 features to edit your content but present the content not only on a Drupal frontend but also on mobile apps or anything else that can work with JSON data.

Tỉ phú Facebook cưỡi trâu thăm bản Hồ, Sapa

Tỉ phú Facebook cưỡi trâu thăm bản Hồ, Sapa

CEO của Facebook đã có một ngày đi bộ khám phá các bản làng gần Sapa, cùng bạn gái đạp xe, cưỡi trâu và chơi cả trò bịt mắt bắt dê.

[Phần 2]High performance in Drupal : Lightning fast code

[Phần 2]High performance in Drupal : Lightning fast code

Welcome to the second part of our series on High Performance Drupal. Here we will cover techniques for speeding up your custom modules.

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

 

Diet con trung