Guest User

Untitled

a guest
Oct 15th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. import chn.util.*;
  2.  
  3. public class Lesson19B {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. FileInput input = new FileInput("compact.txt");
  8.  
  9. int[] numbers = new int[100];
  10. int n=0, size, count;
  11.  
  12. while(input.hasMoreTokens()){
  13. numbers[n] = Integer.parseInt(input.readToken());
  14. n++;
  15. }
  16. size = n;
  17. count = size;
  18.  
  19. for(int x=0; x<count; x++){
  20. if(numbers[x]==0){
  21. for(int y=x; y<count; y++){
  22. numbers[y] = numbers[y+1];
  23. size--;
  24. }
  25. }
  26. }
  27.  
  28. for(int z=0; z<count; z++){
  29. System.out.println(numbers[z]);
  30. }
  31.  
  32. }
  33.  
  34. }
Add Comment
Please, Sign In to add comment