Check the Number is Perfect Square or Not > Unix Shell Programming - counter
Sponsored Links


Popular Links


List of Abbreviations

National Highways in India

States & Union Territories of India

Currency of All Countries

Check the Number is Perfect Square or Not > Unix Shell Programming

You are Here: Home > Computer Subjects > Unix Shell Programming…

 

Check the Number is Perfect Square or Not

Code:

clear

echo -n "Enter the Number==> "
read n

v=0
i=1
x=0

while test $i -le $n
do
	x=`expr $i \* $i`

	if test "$x" = "$n"
	then
		v=1
		echo "The Number is a perfect square"
	fi

	i=`expr $i + 1`
done

if test $v -eq 0
then
	echo "The Number is not a perfect square"
fi

Output:

Enter the Number==> 25

The Number is a perfect square

 

Click Here to Find Latest Jobs and Current Affairs

 

Updated: June 1, 2013 — 4:34 am
© 2016. All Rights Reserved. WikiIND.com