Advertisement
Waliullah8328

Next Round(Linear Search 4)

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