Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int N = 10,i,i2,reserv,i3,result = 0;
- int a[] = {1,2,3,4,5,6,5,5,7,7};
- for(i = 0;i<N;i++){
- for(i2 = i+1;i2<N;i2++){
- if(a[i2] == a[i]){
- result++;
- printf("one - %d , two - %d\n",a[i],a[i2]);
- for(i3 = i2;i3<N;i3++){
- reserv = a[i3+1];
- a[i3+1] = a[i3];
- a[i3] = reserv;
- printf("\n");
- for(i = 0;i<N;i++){
- printf("%d ",a[i]);
- }
- printf("\n");
- }
- i2--;
- }
- }
- }
- N -= result;
- printf("%d",result);
- for(i = 0;i<N;i++){
- printf("%d",a[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement