Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #define N 10
  3.  
  4. int Szukaj1(int *A, int x){
  5.     int i = 0;
  6.     A[N+1] = x;
  7.     while(A[i] == x){
  8.         i++;
  9.     }
  10.     if(i<=N){
  11.         return i;
  12.     }
  13.     else{
  14.         return -1;
  15.     }
  16. }
  17.  
  18. int main(){
  19.     int x = 0;
  20.     int A[N] = {1, 3, 15, 17, 4, 5, 2, 21, 10, 7};
  21.     printf("Jakiej liczby szukasz?\n");
  22.     scanf("%i", &x);
  23.     printf("%i", Szukaj1(A, x));
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement