rendered paste body/*pa3Colin Aherncahernprimality test program. input is from a file list.*/import io.*;import java.util.Scanner;class Primes{ static int testPrime(int n){ int temp,ind=1; if(n==1) return 0; for(int i=2;i*i<n;i++){ temp=n%i; if(temp==0){ ind=temp; return ind; break; } } return ind; } static void Usage(){ System.out.println("Usage: java Primes input_file"); } public static void main(String[] args){ Scanner sc; int number,temp=-1,testr; for(int i=0;i<args.length;i++){ try{ sc = new Scanner(new File(args[i])); }catch(FileNotFoundException e){ Usage(); continue; } while(sc.hasNextLine()){ while(temp<0){ if(sc.hasNextInt()){ temp=sc.nextInt(); } } } number=temp; testr=testPrime(number); if(testr==1) System.out.println(number+" is prime."); if(testr>1) System.out.println(number+"is divisable by "+testr); if(testr==0) System.out.println("1 is neither prime nor copmposite"); } }}