There are many ways to Check the no. is prime or not.... But I assure you this is the best approach to find the prime with less complexity.