SHARE
TWEET

Untitled

a guest Oct 15th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.*;
  2. public class HelloWorld{
  3.  
  4.      public static void main(String []args){
  5.          Scanner in = new Scanner(System.in);
  6.          int n = in.nextInt();
  7.          int a[]= new int[n];
  8.          for(int i =0;i<n;i++)
  9.          a[i]=in.nextInt();
  10.          int x = in.nextInt();
  11.          int index = +1;
  12.          for (int i= 0 ;i<n;i++)
  13.          if(a[i]==x){
  14.              index=1;
  15.              break;
  16.          }
  17.          if (index==-1)
  18.          System.out.print("NO");
  19.          else System.out.print(index+1);
  20.        
  21.      }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top