Timur69

arrays

Apr 2nd, 2020
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. package Tasks2;
  2.  
  3. import java.util.Arrays;
  4. import java.lang.String;
  5.  
  6. public class ArrayInt {
  7.     public static void main(String[] args) {
  8.         int[] arr = {2, 4, 5, 6, 8};
  9.         int a = 2;
  10.         boolean c = false;
  11.         for (int i = 0; i < arr.length; i++) {
  12.             if (a == arr[i]) {
  13.                 c = true;
  14.             }
  15.             System.out.println(c);
  16.             break;
  17.         }
  18.     }
  19. }
Add Comment
Please, Sign In to add comment