kabbo512

Untitled

Jul 12th, 2019
75
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Linear
  2. #include<stdio.h>
  3. int main()
  4. {
  5.     int arr[10],i,n,loc,ck,key;
  6.     scanf("%d",&n);
  7.     for(i = 0; i< n; i++)
  8.  
  9.         scanf("%d",&arr[i]);
  10.         scanf("%d",&key);
  11.  
  12.     ck = 0;
  13.     for(i = 1; i< n; i++)
  14.     {
  15.         if (arr[i] ==key)
  16.         {
  17.                         ck = 1;
  18.                         loc =i+1;
  19.         }
  20.  
  21.     }
  22.     if(ck == 1)
  23.  
  24.         printf("Found at %dth position",loc);
  25.  
  26.     else
  27.         printf("Not found\n");
  28.     return 0;
  29. }
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.

×