answersLogoWhite

0


Best Answer
shell script for check whether the given no is prime or not??

echo "input any number:"

read no

no=`expr $no`

i=`expr 2`

while [ $i -lt $no ]

do

if [ `expr $no % $i` -eq 0];

then

echo "$no is not a prime no.."

break 2

fi

i=`expr $i +1`

done

if [ $i -eq $no ];

then

echo "$no is a PRIME no..."

fi

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a shell script to check whether the given input is prime or not?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write an algorithm to check whether the given number is odd or even?

Type your answer here... i think we should first enter 1 number then check it


Lab manual in mca 1st sem from ignou?

write a program in C to check whether a given number is apalindrome or not


Could you write a assembly language program in tasm To check whether a given number present in a sequence of given memory location containing the string to be checked in 8086?

8086 assembly language program to check wether given number is perfect or not


How do you write a shell script which counts the last 10 lines present in a given file?

You don't need a shell script to do this - just use the 'tail' command.


Shell script to find amstrong numbers within a given range?

Check below link


To check whether the given number is an Avogadro number or not?

45


Write a shell programs for to check whether the given number is an Avogadro number or not?

Avogadro's number is a constant. Therefore only one number is equal to Avogadro's number.


How do you write a shell script which counts the number of lines and words present in a given file?

#!/bin/sh wc -lw "$1"


Write a shell script to count the number of times is appears in a given text file?

You don't need a shell script to do this; use the 'grep' command with the '-c' option to count the number of occurrences of some pattern.


How do i write an emcee script for a welcome ceremony?

just have a clear sequence of who are the guest speakers.. and breiefly introduce them after yoy have given info about the ceremomy.


How can you set up a script on a web page that can check a server specifically a Minecraft server to see if people are logged into that server given the IP address?

No


How do you create an odd or even script using PHP?

To determine whether a given number is odd or even: function odd_even($i) { return ($i % 2 == 0 ? 'even' : 'odd'); }