Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
420 B
3
Indexable
Never
#include <iostream>

using namespace std;

int main() {
    int n;
    unsigned long long giaiThua = 1;

    cout << "Nhap vao mot so nguyen n: ";
    cin >> n;

    if (n < 0 || n >= 20) {
        cout << "Gia tri n khong hop le!";
        return 0;
    }

    for (int i = 1; i <= n; ++i) {
        giaiThua *= i;
    }

    cout << "Giai thua cua " << n << " la: " << giaiThua;

    return 0;
}
Leave a Comment