ziobrowskyy

szukanie w tablicy2 / c

Nov 24th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. void main() {
  2.  
  3. printf("Podaj szukana wartosc z zakresu %d do %d\n", min, max);
  4. int x;
  5. scanf("%d", &x);
  6.  
  7. int znaleziono = 0;
  8.  
  9. for(int i = 0; i < size; i++) {
  10. if(tab[i] == x) {
  11. znaleziono = 1;
  12. printf("Liczba znajduje sie na pozycji %d w tablicy", i);
  13. break;
  14. }
  15. }
  16.  
  17. if(znaleziono == 0) {
  18. printf("Nie znaleziono tej liczby w tablicy");
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment