Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int a[20],b[10],c[10],j=-1,k=-1,i=0,m;
  5. printf("Input the maximum size of array:");
  6. scanf("%d",&m);
  7. printf("Input the array:\n");
  8. for(i=0;i<m;i++)
  9. scanf("%d\n",&a[i]);
  10. if(m<0)
  11. printf("split is not possible.");
  12. else
  13. {
  14. A:
  15. if(a[i]%3==0)
  16. {
  17. j=j+1;
  18. b[j]=a[i];
  19. i++;
  20. }
  21. else
  22. {
  23. k=k+1;
  24. c[k]=a[i];
  25. i++;
  26. }
  27. {
  28. if(i<m)
  29. goto A;
  30. else
  31. printf("\nAfter spliting the array as divide by three:\n");
  32. for(i=0;i<=j;i++)
  33. printf("%d\n",b[i]);
  34. printf("And");
  35. for(i=0;i<=k;i++)
  36. printf("%d\n",c[i]);
  37. }
  38. }
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement