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

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

Bài tập 40 (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(x^n + CanBac2(x^n-1 + … + CanBac2(x^2 + CanBac2(x)))) có n dấu căn

S(n) = xn + xn - 1 + xn - 2 + ... x2 + x

có n dấu căn

Cài đặt

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
    int i, n;
    float x, T, S;
    i = 1;
    T = 1;
    S = 0;
    do
    {
    printf("\nNhap x(x >= 0): ");
    scanf("%f", &x);
      if(x < 0)
      {
          printf("\nx khong hop le. Xin nhap lai !");
      }
    }while(x < 0);
    do
    {
    printf("\nNhap n(n >= 1): ");
    scanf("%d", &n);
    if(n < 1)
      {
          printf("\nn khong hop le. Xin nhap lai !");
      }
    }while(n < 1);
    while(i <= n)
    {
        T = T * x;
        S = sqrt(T + 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 (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 Managing configuration trong Drupal 8

Hướng dẫn Managing configuration trong Drupal 8

Drupal 8 has a whole new configuration system that uses human-readable text files in the YAML (.yml) format to store configuration items. 

National September 11 Memorial & Museum

Thiết kế website Drupal: www.911memorial.com

The original 9/11 Memorial.org site was a loosely connected assortment of independent applications including a storefront, blog, and donation pages.

Galaxy Nexus with Android 4.0 Ice Cream Sandwich

Today Google and Samsung announced the new smartphone Galaxy Nexus, Galaxy Nexus is the first LTE-enabled smartphone powered with Android 4.0 aka Ice Cream Sandwich.

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

 

Diet con trung