#include <bits/stdc++.h>
using namespace std;
long long n,gt;
int main()
{
cin>>n;
gt=1;
for (int i=1; i<=n; i++) gt*=i;
cout<<gt;
return 0;
}
Viết bằng Pascal:
Var n,i gt:longint;
Begin
Write('Nhap n = ');readln(n);
gt:=1;
For i:=1 to n do gt:=gt*i;
Write(n,'! = ',gt);
Readln;
End.