Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function indice, tab, n
- res = -1
- s = n_elements, tab
- for i=0 ; s do
- if (tab[i] = n) then res = i
- end
- return(res) ;
- end function
- pro P1
- t=[6 8 11 54 23 91 3 5 8]
- read, n
- i = indice(t, n)
- if (i neq -1) do begin
- print, n, ' se trouve à l'indice ', i
- endif else print, n, 'n est pas dans le tableau'
- endpro
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement