Advertisement
Robert_Manea

Eliminare 0 cu 2 vectori

Dec 8th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int main(){
  6. int n,i=0, contor=0;
  7. int a[100], b[100];
  8.  
  9. printf("introdu n:");
  10. scanf("%d", &n);
  11.  
  12. for(i=0;i<n;i++){
  13. scanf("%d",&a[i]);
  14. }
  15.  
  16. for(i=0 ; i < n;i++){
  17. if(a[i] != 0){
  18. b[contor] = a[i];
  19. contor++;
  20. }
  21. }
  22.  
  23. for(i = 0; i < contor; i++){
  24. printf("%d ", b[i]);
  25. }
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement