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.
- Bash program to check if the Number is a Palindrome
- Bash program to find A to the power B
- Fibonacci Series in Bash
- Simple Calculator in Bash
- Average of given numbers in Bash
- Programs for printing different patterns in Bash
- Bash shell script to swap two numbers
- Bash Script to get Low Battery Alert in Linux
- Useful and time saving bash commands in Linux
- Sorting an array in Bash using Bubble sort
- Bash shell script to find sum of digits
- Write a bash script to print a particular line from a file
- How to Fix Minimal BASH Like Line Editing is Supported GRUB Error In Linux?
- Bash shell script to find out the largest value from given command line arguments
- How to check if a directory or a file exists in system or not using Shell Scripting?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : shubham_singh