Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. for (( i=0; i<N-1; i++ )); do
  2. tmp=$(( sorted_array[i+1] - sorted_array[i] ));
  3. if [ $tmp < $result ]; then result=$tmp fi
  4. done
  5.  
  6. /tmp/Answer.sh: line 42: syntax error near unexpected token `done'at Answer.sh. on line 42
  7. /tmp/Answer.sh: line 42: `done' at Answer.sh. on line 42
  8.  
  9. for (( i=0; i<N-1; i++ )); do
  10. tmp=$(( sorted_array[i+1] - sorted_array[i] ))
  11. if [ "$tmp" -lt "$result" ]; then result=$tmp; fi
  12. done
  13.  
  14. for (( i=0; i<N-1; i++ )); do
  15. tmp=$(( sorted_array[i+1] - sorted_array[i] ))
  16. [ $tmp -lt $result ] && result=$tmp
  17. done
  18.  
  19. for (( i=0; i<N-1; i++ ))
  20. do
  21. tmp=$(( sorted_array[i+1] - sorted_array[i] ))
  22. if [ $tmp -lt $result ]
  23. then
  24. result=$tmp
  25. fi
  26. done
  27.  
  28. for (( i=0; i<N-1; i++ )); do
  29. tmp=$(( sorted_array[i+1] - sorted_array[i] ))
  30. if [ $tmp -lt $result ]; then result=$tmp; fi
  31. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement