Bài 16: Tính S(n) = x + x^2/1 + 2 + x^3/1 + 2 + 3 + … + x^n/1 + 2 + 3 + …. + N

Bài 16: Tính S(n) = x + x^2/1 + 2 + x^3/1 + 2 + 3 + … + x^n/1 + 2 + 3 + …. + N

Bài tập 16 (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) = x + x^2/1 + 2 + x^3/1 + 2 + 3 + … + x^n/1 + 2 + 3 + …. + N

Cài đặt

#include<stdio.h>
#include<conio.h>

int main()
{
    int i, n;
    float x, S, T;
    long M;
    printf("\nNhap x: ");
    scanf("%f", &x);
    do
    {
    printf("\nNhap n: ");
    scanf("%d", &n);
      if(n < 1)
      {
          printf("\n N phai >= 1. Xin nhap lai !");
      }

    }while(n < 1);

    S = 0;
    T = 1;
    M = 0;
    i = 1;

    while(i <= n)
    {
        T = T * x;
        M = M + i;
        S = S + T/M;
        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

 
5 Ứng dụng web có thể triển khai không cần code

Drupal Vietnam: 5 Ứng dụng web drupal có thể triển khai

Với những công cụ hỗ trợ ưu việt trong công nghệ ngày nay thì có và chạy được một site Drupal đầy đủ tính năng không còn gì là khó khăn nữa.

Book: Front End Drupal, Designing, Theming and Scripting

Download sách Drupal: Theming and Scripting, Designing

Drupal faces a common problem on the Web–the relative lack of new, high quality themes. Front End Drupal tackles this problem directly and is designed to help both experienced designers and rank novices get an understanding of how Drupal theming works. In fact, I’ll be the first to admit I learned a lot from this book.

 Drupal 8 system plugin

Cần học một số kỹ thuật trong Drupal 8 system plugin

Drupal 8 comes with a brand new plugin system. This article provides a high-level overview of both the annotation and hook discovery mechanisms by examining a real world implementation in the form of core's Field API Widgets.

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

 

Diet con trung