Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define N 10
- int Szukaj(int A[N], int x){
- int i=0;
- do{
- i++;
- }
- while((A[i]!=x) || (i!=N));
- if(A[i]==x){
- return i;
- }
- else{
- return 0;
- }
- }
- int main(){
- int x;
- int A[N]={1, 3, 15, 17, 4, 5, 2, 21, 10, 7};
- printf("Jakiej liczby szukasz?\n");
- scanf("%i", &x);
- printf("%i", Szukaj(A, x));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement