ErSKS / Java

Java Training
http://khec.edu.np/
MIT License
16 stars 17 forks source link

Develop - BunkerArray #39

Closed ErSKS closed 7 years ago

ErSKS commented 7 years ago

Develop a static method static boolean isBunker(int[] a) {} for the following PSVM

public static void main(String[] args) {
        System.out.println("Bunker Array - contains the value 1 if and only if it contains a prime number");
        System.out.println("{7, 6, 10, 1} true:" + isBunker(new int[]{7, 6, 10, 1}));
        System.out.println("{7, 6, 10} false:" + isBunker(new int[]{7, 6, 10}));
        System.out.println("{6, 10, 1} false:" + isBunker(new int[]{6, 10, 1}));
        System.out.println("{3, 7, 1, 8, 1} true:" + isBunker(new int[]{3, 7, 1, 8, 1}));
        System.out.println("{7, 6, 10, 9, 5, 0, 1} true:" + isBunker(new int[]{7, 6, 10, 9, 5, 0, 1}));

        System.out.println("{7, 10} false:" + isBunker(new int[]{7, 10}));
        System.out.println("{6, 1} false:" + isBunker(new int[]{6, 1}));
        System.out.println("{3, 1, 1} true:" + isBunker(new int[]{3, 1, 1}));
}
milan604 commented 7 years ago

package bunkerexample;

/*

} Class PrimeCheck package bunkerexample;

/*

}

Output screenshot from 2017-08-16 10-10-52

SusanCB commented 7 years ago

/*

/*

RakenShahi commented 7 years ago

/*

/*

OUTPUT bunker

jagdish4249 commented 7 years ago

package bunkerarray39;

/*

// System.out.print("count1 = "+ count1); // System.out.println("countPrime="+ countPrime); return result; }

}

image

sajanbasnet75 commented 7 years ago

/*

/*

Sudan15423 commented 7 years ago

/*

/*

} capture

ajay987 commented 7 years ago

/*

/*

} sol39

karmi214 commented 7 years ago

/*

/*

} capture