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

 
Hướng dẫn Show Drupal Users Their Own Content

Hướng dẫn Show Drupal Users Their Own Content

There are advanced ways to do this, such as using the Workbench module, but in this tutorial we'll show you an easy way to provide a list of each user's content.

cong tac trien khai do dac giam that thoat nuoc

6 năm triển khai công tác giảm thất thoát nước sạch tiết kiệm hơn 800 tỷ đồng

Nhờ triển khai nhiều giải pháp, Công ty Cổ phần Cấp nước Gia Định - đơn vị trực thuộc Tổng công ty cấp nước Sài Gòn TNHH Một Thành Viên giảm được tỉ lệ thất thoát nước từ 53% còn hơn 16%, tiết kiệm được 807 tỉ đồng.

Tính năng tìm kiếm mới: Google Application Search

Tính năng tìm kiếm mới: Google Application Search

Today I spotted a new search option on Google – “Applications”. Not sure if I’ve been blind or this is a completely new option in the “More” section.

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

 

Diet con trung