Tính S= 1/2 * 1/3 *...*1/N N = 10 Giúp nhanh hộ em với ạ

2 câu trả lời

Program baitap;

Uses crt;

Var i,N: integer;

      S: real;

Clrscr;

N:=10;

S:=1;

For i:=1 to N do S:=S*1/N;

Writeln('Ket qua cua bieu thuc la:',S);

Readln;

End.

#include<iostream>
using namespace std;

int main()
{
    int a[10];
    for(int i = 2; i <= 10; ++i)
        a[i] = i;
    int i = 2;
    double nume = a[i] + a[i+1];
    double deno = a[i] * a[i+1];
    i += 2;
    while(i <= 10)
    {
        nume = (nume * a[i]) + deno;
        deno = deno * a[i];
        i++;
    }
    printf("%.4f",nume / deno);
}

Câu hỏi trong lớp Xem thêm