Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int a[100];
- int n, i, m;
- int position;
- printf("How many numbers?\n");
- scanf("%d", &n);
- for(i = 0; i < n; i++)
- {
- printf("Enter number %d: ", i+1);
- scanf("%d", &a[i]);
- }
- printf("Enter the number you want to search: ");
- scanf("%d", &m);
- for(i = 0; i < n; i++)
- if(a[i] == m)
- {
- position = i;
- break;
- }
- if(position == n)
- printf("Number not found\n");
- else
- printf("%d found at position %d\n", m, position);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement