Advertisement
Guest User

Untitled

a guest
Apr 4th, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
IDL 0.31 KB | None | 0 0
  1. function indice, tab, n
  2. res = -1
  3. s = n_elements, tab
  4. for i=0 ; s do
  5. if (tab[i] = n) then res = i
  6. end
  7. return(res) ;
  8. end function
  9. pro P1
  10. t=[6 8 11 54 23 91 3 5 8]
  11. read, n
  12. i = indice(t, n)
  13. if (i neq -1) do begin
  14. print, n, ' se trouve à l'indice ', i
  15. endif else print, n, 'n est pas dans le tableau'
  16. endpro
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement