Created
February 25, 2018 18:50
-
-
Save gallirohik/24882fb5b2c49e36e2f1472e6ee6b5dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int *arr=(int *)malloc(20*sizeof(int)),count[3]={0},n,i,j; | |
printf("enter n:"); | |
scanf("%d",&n); | |
for(i=0;i<n;i++) | |
{ | |
scanf("%d",&arr[i]); | |
count[arr[i]]++; | |
} | |
for(i=0;i<n;i++) | |
{ | |
if(count[j]==0) | |
count[j++]; | |
arr[i]=j; | |
count[j]--; | |
} | |
for(i=0;i<n;i++) | |
printf("%d",arr[i]); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment