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

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

Bài tập 17 (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/2! + x^3/3! + … + x^n/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 = 1;
    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

 
Man City khát khao vô địch UEFA Champions League 2020

Man City khát khao vô địch UEFA Champions League 2020

Man City cùng các nhà tài trợ không ngại thao túng hợp đồng. Khi Chumillas hỏi Pearce rằng liệu họ có thể thay đổi thời gian ký hợp đồng tài trợ,

Install Midnight Commander (MC) 4.7.3 In Ubuntu

Install Midnight Commander (MC) 4.7.3 In Ubuntu

Midnight Commander is probably the most well-known console file manager and probably the most easy to use due to being the closest to Norton Commander...

Apple phản hồi với lỗi bảo mật SMS trên iPhone

Apple phản hồi với lỗi bảo mật SMS trên iPhone

Một hacker jailbreak có biệt danh pod2g đã phát hiện ra một lỗi bảo mật nghiêm trọng liên quan tới hệ thống tin nhắn SMS trong hệ điều hành iOS 6 và ngay ngày hôm sau Apple đã phản hồi lại thông tin trên.

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

 

Diet con trung