Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int i,n;
- printf("podaj ilosc elementow tablicy:\n");
- scanf("%d",&n);
- int tab[n],s,sr,l,p,srch;
- printf("podaj poszczegolne elementy:\n");
- for(i=0;i<n;i++){
- scanf("%d",&tab[i]);
- }
- printf("podaj szukana wartosc:\n");
- scanf("%d",&s);
- for(l=0;l<n;l++){
- p=n-1;
- sr=(l+p)/2;
- if(tab[sr]<s)
- l=sr;
- else if(tab[sr]>s)
- p=sr;
- else
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement