Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	f := 1
	for i := 1; i <= n; i++ {
		f *= i
	}
	fmt.Println(f)
}

C++: #include<iostream>
unsigned long long factorial(int n)
{
	if (n == 1)
	{
		return 1;
	}
	else
	{
		return n * factorial(n - 1);
	}
}
int main()
{
	int n;
	std::cin >> n;
	std::cout << factorial(n) << std::endl;
	return 0;
}

C++: #include<iostream>
int input=0;

long long factorial(int n)
{
	if(n==0)
		return 1;
  return (n == 1 || n == 0) ? 1 : factorial(n - 1) * n;
}

int main()
{
	do
	{	
		std::cin>>input;
		if(input<0||input>20)
			break;
		std::cout<<factorial(input);
	}while(true);


	return 0;
}

C++: #include<iostream>
main(){int n,i;std::cin>>n;for(i=n;--n;)i*=n;std::cout<<i;}

C++: #include<iostream>
using namespace std;
 
long long ans=1;
 
long long factorial(int n){   // 再起関数
  if(n==1){
    return ans;
  }else{
    ans = n*factorial(n-1);
  }
}
 
int main(){
  int n;
  cin >> n;
 
  if(n<0){
    cout << "計算できません。" << endl;
  }else if(n==0 || n==1){
    cout << 1 << endl;
  }else{
    cout << factorial(n) << endl; // 再起
  } 
  return 0;
}

C++: #include <iostream>
using namespace std;

int main(){
	int n,fac=1;
	cin>>n;
	for(int i=1;i<=n;i++){
		fac*=i;
	}
	cout<<fac<<endl;
	return 0;
}

C++: #include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

//Nayeem Shahriar Joy,Applied Physics And Electronic Engineering,University of Rajshahi.

int main(void)

{
    unsigned long long int n,i,ans=1;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        ans=(ans*i);
    }
    cout<<ans<<endl;
}

C++: #include<iostream>

using namespace std;

int f(int n) {
    if (n==1) return 1;
    if (n==2) return 2;

    return n*f(n-1);
}

int main() {
    
    int n;
    cin >> n;
    cout << f(n) <<endl;
    
    return 0;
}

C++: #include <stdio.h>

int main()
{
  int n;
  int result;

  scanf("%d", &n);

  result = 1;

  while(n>0)
    result *= (n--);

  printf("%n\n", n);

  return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;

ll fact(int n) {
	if(n == 0) return 1;
	return n * fact(n - 1);
}

int main(){
	int n; cin >> n;
	cout << fact(n) << endl;
	return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){

    int n;
    cin>>n;
    int ans=1;
    for(int i=1;i<=n;i++){
        ans*=i;
    }
    cout<<ans<<endl;
    return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
using namespace std;
#define f(i,n) for(i=1; i<=n;i++)
int main(){
    long long s=1,n,i,a,b,k;
    char c;
    scanf("%lld", &n);
    f(i,n)
        s=s*i;                   
    printf("%lld", s);
    cout<<endl;
    return 0;
}

C++: #include<iostream>

using namespace std;

long long factorial(long long n){
  long long int ans;
  if(n==0)
    ans=1;
  else
    ans =n*factorial(n-1);
  return ans;
}

int main(){
  long long  n=0;
  cin>>n;

  long long int ans=1;
  ans=factorial(n);

  cout<<ans;
}

C++: #include<iostream>
using namespace std;

int kaijo(int n){
	if(n <= 1)
		return 1;
	return n*kaijo(n-1);
}

int main(){
	int n;
	cin >> n;
	cout << kaijo(n) << endl;
	return 0;
}

C++: //#define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 81
#define _MAX 100
#define ABC 26
int main(void)
{
	int n, ans = 1;
	scanf_s("%d", &n);
	for (int i = 1; i <= n; ++i) {
		ans *= i;
	}
	printf("%d\n", ans);
}

C++: #include <iostream>
using namespace std;

int main(void)
{
	int N;
	long long accum = 1;

	cin >> N;

	while(N > 0){
		accum *= N;
		N--;
	}
	cout << accum << endl;


	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;

unsigned long long Kaijo(int n) {
	int m;
	if (n == 0)
		return 1;
	m = Kaijo(n - 1);
	return m*n;
}

int main() {
	int n;
	cin >> n;
	cout << Kaijo(n) << endl;
	return 0;
}

C++: #include <iostream>
#include <cstdint>
 
int main()
{
    std::uint32_t n;
    std::cin >> n;
    std::uint64_t factorial = 1;
    while (n > 0) {
        factorial *= n--;
    }
    std::cout << factorial << std::endl;
    return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
    int i,n,fact;
    fact =1;
    cin>>n;
    for(i=1;i<=n;i++)
        fact=fact*i;
    {
        cout<<fact<<endl;
    }
    return 0;
}