Go: package main

import (
	"fmt"
)

func main() {
	for {
		var a int
		fmt.Scan(&a)
		if a == 0 {
			break
		}
		rs := 0

		for i := 0; i < 10; i++ {
			for j := 0; j < 10; j++ {
				for k := 0; k < 10; k++ {
					for l := 0; l < 10; l++ {
						if i+j+k+l == a {
							rs++
						}
					}
				}
			}
		}
		fmt.Println(rs)
	}
}

C++: #include <iostream>

using namespace std;

int a[28] = {1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 105, 91, 78, 66, 55, 45, 36, 28, 21, 15, 10, 6, 3, 1};

int main()
{
    int n;
    for(;;){
        if(cin >> n){
            int b = 0;
            for(int i = 0; i < 10; i++){
                if(n - i >= 0 && n - i <= 27){
                    b += a[n - i];
                }
            }
            cout << b;
        }else{
            break;
        }
    }
}

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

int ans = 0;
int input;


int main(){
	while(scanf("%d", &input)!=EOF){
		ans = 0;
		for(int i=0; i < 10; i++){
			for(int j=0; j < 10; j++){
				for(int k =0; k < 10; k++){
					for(int l =0; l < 10; l++){
						if(i+j+k+l == input) ans++;
					}
				}
			}
		}
		cout << ans << endl;
	}
}

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

int main()
{
	int n,a,b,cnt=0;
	cin >> n;
	for(a=0;a<=18;a++){
		for(b=0;b<=18;b++){
			if(a+b==i) cnt+= (10-abs(a-9)) * (10-abs(b-9));
		}
	}
	cout << cnt << endl;
	return 0;	
}

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

int main () {

int n, count = 0;

while(cin >> n){

    for (int a = 0; a < 10 && a <= n; a++){
        for (int b = 0; b < 10 && b <= n-a; b++){
            for (int c = 0; c < 10 && c <= n-a-b; c++){
                if (n-a-b-c >=0 && n-a-b-c < 10) {
                    count++;
                }
            }
        }
    }

}
    cout << count;


    return 0;

}

C++: #include<iostream>

int main(){
	int a,b,c,d,i,n;
	
	i=0;
	while(std::cin>>n){
	for(a=0;a<=9;a++){
		for(b=0;b<=9;b++){
			for(c=0;c<=9;c++){
				for(d=0;d<=9;d++){
					if(a+b+c+d==n){
						i++;
					}
				}
			}
		}
	}
	std::cout<<i<<std::endl;
		}
	return 0;
}

C++: #include <stdio.h>

int main()
{
	int n,dp[51][4];

	for(int i = 0; i < 51; i++){
		if(i < 10)
			dp[i][0] = 1;
		else
			dp[i][0] = 0;
		dp[i][1] = 0;
		dp[i][2] = 0;
		dp[i][3] = 0;
	}
	for(int i = 0; i < 3; i++){
		for(int j = 0; j <= 50; j++){
			for(int c = 0; c < 10; c++){
				if(j+c <= 50)
					dp[j+c][i+1] += dp[j][i];
			}
		}
	}
	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 51; j++){
			printf("%d ",dp[j][i]);
		}
		printf("\n");
	}

	while(scanf("%d",&n) != EOF){
		printf("%d\n",dp[n][3]);
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int digits_sum(int num) {
    int digit, sum = 0, base = 1000;
    
    while(base != 0) {
        digit = num / base;
        sum += digit;
        num -= base * digit;
        base /= 10;
    }
    
    return sum;
}

int main() {
    int n, res, cnt;
    
    while(cin >> n) {
        cnt = 0;
        
        for(int i = 0;i < 10000;i++) {
            res = digits_sum(i);
            
            if(res == n) {
                cnt++;
            }
        }
        
        cout << cnt << endl;
    }
    
    return 0;
}

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

int solve(){
    int ans = 0;
    for(int i = 0; i <= 9; ++i){
        for(int j = 0; j <= 9; ++j){
            for(int k = 0; k <= 9; ++k){
                for(int l = 0; l <= 9; ++l){
                    int tmp = i + j + k + l;
                    if(tmp == N) ans++;
                }
            }
        }
    }
    return ans;
}

int main(){
    cin >> N;
    int ans = solve();
    cout << ans << endl;
}

C++: #include<iostream>

using namespace std;

int main(){
	int n, ans;
	int counter = 0;
	while (cin >> n){
		for (int i = 0; i < 10; i++){
			for (int q = 0; q < 10; q++){
				for (int w = 0; w < 10; w++){
					for (int e = 0; e < 10; e++){
						ans = i + q + w + e;
						if (ans == n){
							counter += 1;
						}
					}
				}
			}
		}
		cout << counter << endl;
	}
}

C++: #include <bits/stdc++.h>
//#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;



signed main() {
	ll n;
	while (cin >> n) {
		ll ans = 0;
		for(ll i = 0 ;i<10;i++)
			for (ll j = 0; j < 10; j++)
				for (ll k = 0; k < 10; k++) {
					ll d = n - i - j - k;
					if (0 <= d && d < 10) ans++;
				}
		cout << ans << endl;
	}
}

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

int main(){
  int s,h = 0;
  int n,t = 0;
  cin>>n>>t;

  for(int a = 0; a<10; a++){
 for(int b = 0; b<10; b++){
 for(int c = 0; c<10; c++){
 for(int d = 0; d<10; d++){

   if(a+b+c+d == n){
     s++;
   }else if(a+b+c+d ==t){
     h++;
   }
 }
 }
 }
  }
  cout<<s<<endl;
  cout<<h<<endl;

  return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,cont;
  while(scanf("%d",&n)!=EOF){
    cont=0;
    for(int i=0;i<10;i++){
      for(int j=0;j<10;j++){
	for(int k=0;k<10;k++){
	  for(int l=0;l<10;l++){
	    cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl;
	    if(i+j+k+l==n)cont++;
	  }
	}
      }
    }
    cout<<cont<<endl;
  }
}

C++: #include <iostream>

using namespace std;
 
int main(int argc, char** argv) {
    int n;
    while(cin >> n) {
        int count = 0;
        for(int a=0; a<=9; a++) {
            for(int b=0; b<=9; b++) {
                for(int c=0; c<=9; c++) {
                    for(int d=0; d<=9; d++) {
                        if(a+b+c+d == n) {
                            count++;
                        }
                    }
                }
            }
        }
        cout << count << endl;
    }
    return 0;
}

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

int main(){
	int n,num = 0;
	while(cin >> n){
		for(int a = 0; a < 10; ++a){
			for(int b = 0; b < 10; ++b){
				for(int c = 0; c < 10; ++c){
					for(int d = 0; d < 10; ++d){
						if(a + b + c + d == n){
							++num;
							break;
						}
					}
				}
			}
		}
	cout << num << '\n';
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int a[50];
int b[50];
int main(){
	for (int x = 0; x < 50; x++){
		cin >> a[x];
		while (cin >> a[x])


			for (int i = 0; i < 10; i++){
				for (int j = 0; j < 10; j++){
					for (int k = 0; k < 10; k++){
						for (int l = 0; l < 10; l++){
							if (i + j + k + l ==a[x] ){
								b[x]++;
							}
						}
					}
				}
			}
	}
	for(int x=0;x<50;x++)
{
cout << b[x] << endl;
}

	return 0;
}

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

int main(){
    int i,j,k,l;
    
    int ans = 0;
    
    int n;

    while(cin >> n){
        ans = 0;
    
        for(i=0;i<10;i++){
        
            if(i>n)break;
            for(j=0;j<10;j++){
                    
                    for(k=0;k<10;k++){
                        for(l=0;l<10;l++){
                            if((i+j+k+l)==n){
                                    ans++;
                            }
                        }
                    }
            }
        }
cout << ans << endl;
    }
    
    

    return 0;
}

C++: #include <stdio.h>
#include <iostream>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
int n;
int main() {
	int a, b, c, d;
	while(scanf("%d\n", &n) != EOF) {
		int count = 0;
		rep(a,10) {
			rep(b,10) {
				rep(c,10) {
					rep(d,10) {
						if(a + b + c + d == n) count++;
					}
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}