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

 
Real Player Entertainment Apps For Your Android

Real Player Entertainment Apps For Your Android

Entertainment on your phone is very important for any Android phone users. If you want to enjoy your music, play some cool videos and scroll your phone really fast then you may consider getting yourself the RealPlayer.

Open Android Apps with Voice Control

Open Android Apps with Voice Control

There are lots of smartphone apps are available in the market which allows you to recognize your voice and controls the apps.

Installing Drupal 7 as a Multisite (esp. GreenGeeks)

Hướng dẫn cài đặt Drupal 7 Multisite

Do you have more than a few installations of Drupal 7 on a server? Tired of doggedly updating the core files when they're released

Tomdesgin.vn

 

Drupal Services