Advertisement
Md_hosen_zisad

LINEAR SEARCH

Feb 18th, 2018
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.23 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.  
  5.     int n,i, a[100];
  6.     for(i=0;i<5;i++)
  7.     {
  8.         scanf("%d",&a[i]);
  9.     }
  10.     printf("position");
  11.     scanf("%d",&n);
  12.     for(i=1;i<=5;i++)
  13.     {
  14.         if(n==a[i])
  15.         {
  16.             printf("%d",i);
  17.         }
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement