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