import java.sql.SQLOutput; import java.util.Arrays; import java.util.Scanner; public class PJJJeden { public static boolean check(int[] tab, int x) { for (int i = 0; i <= tab.length; i++) { if (x == tab[i]) { return true; } } return false; } public static void main(String[] args) { int tab[] = {1, 2, 3, 4, 5}; int a = 0; Scanner sc = new Scanner(System.in); System.out.println(" Podaj wartosc: "); int x = sc.nextInt(); System.out.println(check(tab, 4)); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter