148,692 views
2 votes
2 votes
Write a java program to create and display unique three digit number using 1,2,3 and 4 also count how many three digit number are there.

Expected

123

124

---

---

431

432

User Wrayvon
by
3.3k points

1 Answer

5 votes
5 votes

Answer:

Answered below

Step-by-step explanation:

Class Unique{

public static void main(String args[]){

int myArray[] = {1, 2, 3, 4};

int newArray[];

int i;. int j; int k;

for(i = 0; i < myArray.length; I++)

for(j = 0; j< myArray.length; j++)

for(k = 0; k< myArray.length; k++){

if(i != j && j!= k && i != k ){

newArray.add(myArray[i] + myArray[j] + myArray[k]);

}

}

int count = 0;

for(int m = 0; m < newArray.length; m++){

count++;

}

System.out.print(newArray, count)

}

}

User Detty
by
3.4k points