The time limit is exceeding in case I declare a large array. pls check the code https://ide.codingblocks.com/s/95492
@urvigoel26 hey urvi this approach will not work try with sieve of erthothanes algorithm.