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

 
Google sắp tung ra dịch vụ lưu trữ trực tuyến

Google sắp tung ra dịch vụ lưu trữ trực tuyến

Theo thông tin của một tờ báo uy tín, Google sẽ sớm tung ra một dịch vụ lưu trữ đám mây, cạnh tranh trực tiếp với Dropbox hay Box.net.

Google Voice App Review

Google Voice App Review

Finally ending the long wait, the Google Voice has rolled out in its full glamour from the Google factory. It is the like the apple of the Apple’s eye. One of the most downloaded versions in the Apple’s App Store, this Google Voice application is a cult in its own right.

Samsung Galaxy Z Review

Samsung Galaxy Z Review

Samsung recently launched a new phone in the market; the Samsung Galaxy Z. this very pretty gadget is very slim and light. This amazing phone has 480 x 800 pixels, touch screen, a multi touch in put method and comes in 16 different colors.

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

 

Diet con trung