- Related Questions & Answers
- C# Program to check if a number is prime or not
- Python program to check if a number is Prime or not
- PHP program to check if a number is prime or not
- Write a C# program to check if a number is prime or not
- Bash program to check if the Number is a Palindrome?
- 8085 program to determine if the number is prime or not
- Check if a number is Quartan Prime or not in C++
- Check if a number is Primorial Prime or not in C++
- Check if a number is Primorial Prime or not in Python
- C++ Program to Check Whether a Number is Prime or Not
- C Program to Check Whether a Number is Prime or not?
- Check if a number is a Pythagorean Prime or not in C++
- Python Program to Find if a Number is Prime or Not Prime Using Recursion
- Write a Golang program to check whether a given number is prime number or not
- Write a C# program to check if a number is Palindrome or not

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

**Bash** also known as GNU bash is a command language and unix shell script is a command line interpreter for operating system. It was designed by Brian Fox and was a free software which replaced Bourne shell. It first released in 1989 and some became go to for login shell for linux based operating systems like macOS, Linux based softwares, etc.

**Prime** number is a number that has only two factors i.e. the number itself and 1. For example, 2 , 3 , 5, 7 , 11 , 13 , 17 , 19 , 23 , 29….

Here we are given a number, and we need to find whether the given number is prime or not.

Input : A number Output : “The number is prime ” OR “The number is not prime” based on the number.

**Example **−

Input : 23 Output : The number is prime

**Step 1**− Loop from 2 to n/2, i as loop variable**Step 2**− if number is divisible, print “The number is not prime” and flag = 1;**Step 3**− if flag != 1, then print “The number is prime”.**Step 4**− Exit.

number=53 i=2 flag=0 while test $i -le `expr $number / 2` do if test `expr $number % $i` -eq 0 then flag=1 fi i=`expr $i + 1` done if test $flag -eq 1 then echo "The number is Not Prime" else echo "The number is Prime" Fi

The number is Prime

Advertisements