### Help me for duplicate random number.

Hi, I am new here and Im looking for some help. I am trying to make my array without any duplicate number.

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081`` ``````#include #include #include #define BUBBLE 5 int main() { int myArray[BUBBLE]; int i, j ,a , b, k; int temp = 0; int num; int cunt; cunt=0; float floatType; int integerType; srand(time(NULL)); //Fill Array Randomlly for (i = 0; i < BUBBLE; i ++) { num = rand() % BUBBLE + 1; myArray[i] = num; } // For remove duplicate number for (a = 0; i < BUBBLE; a++) { for (b = a + 1; j < BUBBLE;) { if (myArray[a] == myArray[b]) { for (k = b; k < BUBBLE; k++) { myArray[k] = myArray[k + 1]; } BUBBLE--; } else b++; } } // The Array Before Sort for (i = 0; i < BUBBLE; i++) { printf("%d \n ",myArray[i]); } printf("After sort \n",myArray[i]); //Sort Array With Bobble Algorhim for(i = 0; i < BUBBLE; i++) { for (j = 0; j < BUBBLE-1; j++) { if (myArray[j] > myArray[j+1]) { temp = myArray[j]; myArray[j] = myArray[j+1]; myArray[j+1] = temp; cunt++; } } } //Print Array After Sort for (i = 0; i < BUBBLE; i++) { printf("%d\n",myArray[i]); } // Count For How Many Swap printf("the numbeer of pases is %d \n" ,cunt); printf("Size of float: %ld bytes\n",sizeof(floatType)); system("PAUSE"); return 0; }``````

Last edited on
I don't see a question.
To respond to your statement "I am trying to make my array without any duplicate number. "
My suggestion would be simply add "count" to every number and then increase "count" by one. Done.