Divisible challenge
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = sc.nextInt(); String str = sc.nextLine(); String[] nums = str.split(" "); Boolean check = false; System.out.println(num); for(String s: nums){ int val = Integer.parseInt(s); if(num%val==0){ check = true; }else{ check = false; } } if(check){ System.out.println("divisible by all"); }else{ System.out.println("not divisible by all"); } } } I wrote this code and it is giving me an error but I couldn't find what's wrong