Created
          May 28, 2021 09:38 
        
      - 
      
 - 
        
Save bijay-shrestha/49bdc26836eee1eedcc2fc02af0f9d9a to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * Write a program to find out whether a given integer is present in an array or not. | |
| **/ | |
| package com.hawa.practice; | |
| import lombok.extern.slf4j.Slf4j; | |
| @Slf4j | |
| public class PracticeSetTwo { | |
| public static void main(String[] args) { | |
| int find = 13; | |
| boolean found = false; | |
| int[] arrayOfNumbers = {1, 2, 3, 4, 5}; | |
| for (int num : arrayOfNumbers) { | |
| if (num == find) { | |
| found = true; | |
| break; | |
| } | |
| } | |
| log.info("The number {} is found in an array {}. Result: {}", find, arrayOfNumbers, found); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment