Given a number, the task is to find whether the given number is prime or not using Bash Scripting.
Input: N = 43 Output: Prime Input: N = 35 Output: Not Prime
We run a loop from 2 to number/2 and check if there is any factor of the number. If we find any factor then the number is composite otherwise prime.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.