aiNayan

2(iii)

Feb 24th, 2021
794
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. int main()
  3. {
  4.     int arr[100], s, i, n;
  5.     printf("Enter the number of values: ");
  6.     scanf("%d", &n);
  7.     printf("Enter the values: ", n);
  8.     for (i = 0; i < n; i++)
  9.         scanf("%d", &arr[i]);
  10.     printf("Enter the value to search: ");
  11.     scanf("%d", &s);
  12.     for (i = 0; i < n; i++) {
  13.         if (s == arr[i]) {
  14.             printf("%d found at %d index", s, i);
  15.             break;
  16.         }
  17.         else
  18.             printf("%d not found", s);
  19.         break;
  20.     }
  21.     return 0;
  22. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×