fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. void test(int*,int);
  5. int arr1[5]={4,3,1,0,2};
  6. int arr2[5]={4,3,1,1,2};
  7.  
  8. test(arr1,5);
  9. test(arr2,5);
  10. return 1;
  11. }
  12.  
  13. void test(int *arr, int N)
  14. {
  15. int result = 0;
  16. printf("[");
  17. for(int i=0;i<N;i++)
  18. {
  19. printf("%d ",arr[i]);
  20. result ^= i ^ arr[i];
  21. }
  22. printf("]");
  23. if(result==0)
  24. printf(" :There is no repetition\n");
  25. else
  26. printf(" :There is some repetition\n");
  27.  
  28. }
Runtime error #stdin #stdout 0.02s 2680KB
stdin
Standard input is empty
stdout
[4 3 1 0 2 ] :There is no repetition
[4 3 1 1 2 ] :There is some repetition