SHARE
TWEET

Untitled

a guest Oct 19th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5.  
  6. int *arr;
  7. int size;
  8. printf("Enter the size of array: \n");
  9. scanf("%d", &size);
  10. arr = (int*)malloc(size * sizeof(int));
  11. printf("Enter the elements for this array:");
  12. for(int i = 0;i<size;i++){
  13.         scanf("%d", &arr[i]);
  14.  
  15. }
  16. int count = 0;
  17. int i;
  18. for( i = 0;i<size;i++){
  19.  
  20.     if(arr[i] != 0){
  21.  
  22.         arr[count++] = arr[i];
  23.     }
  24.  
  25. }
  26. printf("Elements without zeros: %d \t", arr[i] );
  27.  
  28. return 0;
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top