Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- class Main {
- public static void main(String[] args) {
- int[] num = {1, 2, 3, 4, 5};
- int toFind = 3;
- boolean found = false;
- for (int n : num) {
- if (n == toFind) {
- found = true;
- break;
- }
- }
- if(found)
- System.out.println(toFind + " is found.");
- else
- System.out.println(toFind + " is not found.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement