Bải tập 14: Tính S(n) = x + x^3 + x^5 + … + x^2n + 1

Bải tập 14: Tính S(n) = x + x^3 + x^5 + … + x^2n + 1

Bài tập 14 (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^3 + x^5 + … + x^2n + 1

Cài đặt

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
    int i, n;
    float x, T, S;
    i = 0;
    T = 1;
    S = 0;
    printf("\nNhap x: ");
    scanf("%f", &x);

    printf("\nNhap n: ");
    scanf("%d", &n);

    while(i < n)
    {
        T = pow(x, (2 * i + 1));
        S = S + T;
        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

 
Dễ dàng thêm contextual link vào block trong Drupal 7

Dễ dàng thêm contextual link vào block trong Drupal 7

Contextual link is a nice addition made into Drupal 7 to favor usability. It offers, quick links to pages performing administrative operations.

3 bước để tạo một Module cho Drupal admin interface

3 bước để tạo một Module cho Drupal admin interface

The example we are going to use to create the admin settings interface is a module which displays a message to users when they login. The message itself will be configurable in the admin interface.

Facebook giải quyết thông tin sai lệch một cách hạn chế

Facebook giải quyết thông tin sai lệch một cách hạn chế

Haugen, 37 tuổi, đã xuất hiện trong chương trình 60 Minutes của WSJ ngày 3/10 và điều trần trước Thượng viện Mỹ ngày 5/10 để phản đối cách vận hành và cơ chế hiển thị thông tin ưu tiên theo lượt tương tác của công ty cũ.

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

 

Diet con trung