Skip to content

Instantly share code, notes, and snippets.

@wiryadev
Created April 8, 2020 09:11
Show Gist options
  • Save wiryadev/8b12a51a6fba42afa83e4dc135bce7da to your computer and use it in GitHub Desktop.
Save wiryadev/8b12a51a6fba42afa83e4dc135bce7da to your computer and use it in GitHub Desktop.
public class KamuKitaNikah {
public static void main(String[] args) {
/* KAMU
KITA +
------
NIKAH
tentukan seluruh variasi huruf yang ada : k, a, m, u, i, t, n, h
*/
for(int k=0; k<=9; k++) {
for(int a=0; a<=9; a++) {
for(int m=0; m<=9; m++) {
for(int u=0; u<=9; u++) {
for(int i=0; i<=9; i++) {
for(int t=0; t<=9; t++) {
for(int n=0; n<=9; n++) {
for(int h=0; h<=9; h++) {
int kamu = k*1000 + a*100 + m*10 + u;
int kita = k*1000 + i*100 + t*10 + a;
int nikah = n*10000 + i*1000 + k*100 + a*10 + h;
if(k!=a && k!=m && k!=u && k!=i && k!=t && k!=n && k!=h && (k%2!=0)) {
if(a!=m && a!=u && a!=i && a!=t && a!=n && a!=h) {
if(m!=u && m!=i && m!=t && m!=n && m!=h) {
if(u!=i && u!=t && u!=n && u!=h) {
if(i!=t && i!=n && i!=h) {
if(t!=n && t!=h) {
if(n!=h && n==1) {
if(kamu+kita==nikah) {
System.out.println(" "+k+a+m+u);
System.out.println(" "+k+i+t+a);
System.out.println("-------+");
System.out.println(" "+n+i+k+a+h);
System.out.println("");
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment