echo "Enter three numbers "

read a b c

if [ $a -gt $b -a $a -gt $c ]

then

echo " A is big "

elif [ $b -gt $c ]

then

echo " B is big "

else

echo " C is big "

fi

OUTPUT

[1csea56@local host~]$ sh biggest.sh

3 4 9

C is big

[1csea56@local host~]$ sh biggest.sh

7 5 2

A is big

RESULT:

Thus a program has been written in the UNIX successfully to find the biggest of three numbers and the output is verified.

//FIBONACCI SERIES

echo "enter the number"

read n

f=0

a=0

b=1

i=0

while [ $i -le $n ]

do

f=`expr $a + $f`

a=`expr $b`

b=`expr $f`

i=`expr $i + 1`

echo $f

done

OUTPUT

[1csea56@local host~]$ sh fib.sh

Enter the number

5

0

1

1

2

3

RESULT

Thus a program to perform Fibonacci series was written and executed successfully.

// FACTORIAL OF A NUMBER

echo "Enter the value”

read n

i=1

f=1

while [ $i -le $n ]

do

f=`expr $f \* $i`

i=`expr $i + 1`

done

echo "Factorial Of $n is:$f"

OUTPUT

[1csea56@local host~]$ sh factorial.sh

Enter the number

4

Factorial of 4 is: 24

RESULT

Thus a program to find factorial of a number was written and executed successfully.

// Palindrome program

len=0

i=1

echo “enter the string”

read str

len=`echo $str|wc -c`

len=`expr $len - 1`

halflen = `expr $len/2`

while [ $i –le $halflen ]

do

c1= `echo $str|cut -c $i`

c2= `echo $str|cut -c $len`

if [ $c1! = $c2 ]

then

echo “ string not palindrome”

exit

fi

i=`expr $i +1`

len = `expr $len -1`

done

echo “string is palindrome”

OUTPUT

[1csea56@local host~]$ sh palindrome.sh

Enter the String

malayalam

string is palindrome

[1csea56@local host~]$ sh palindrome.sh

Enter the String

madras

string is not palindrome

RESULT:

Thus a program has been written in the UNIX successfully to find the Palindrome of a string and the output is verified.

//PROGRAM TO PERFORM ARITHMETIC OPERATIONS

echo "enter the numbers"

read a b

echo "menu

1.add

2.sub

3.mul

4.div

5.exit\n"

echo "enter your option"

read op

case $op in

1)

c= `expr $a + $b`

;;

2)

c=` expr $a - $b`

;;

3)

c= `expr $a \* $b`

;;

4)

c= `expr $a / $b`

;;

5)

exit

;;

esac

echo $c

OUTPUT

[1csea56@local host~]$ sh arithemetic.sh

Enter the numbers

1 2

menu

1.add

2.sub

3.mul

4.div

5.exit

enter your option

1

3

[1csea56@local host~]$ sh arithemetic.sh

Enter the numbers

1 2

menu

1.add

2.sub

3.mul

4.div

5.exit

enter your option

2

-1

RESULT

Thus a program has been written successfully in the UNIX to perform the arithmetic operations and the output has been verified

// CHECKING A NUMBER FOR ODD OR EVEN

echo "Enter a number"

read a

z=`expr $a % 2`

if test $z -eq 0

then

echo "Even number"

else

echo "Odd number"

fi

OUTPUT

[1csea56@local host~]$ sh oddoreven.sh

Enter a number

2

Even number

[1csea56@local host~]$ sh oddoreven.sh

Enter a number

5

Odd number

RESULT:

Thus the program is written and executed for checking the given number is even or odd.

//SUM OF DIGITS OF A NUMBER

echo "Enter the number"

read x

c=0

a=0

while [ $x -ne 0 ]

do

c=` expr $x \% 10 `

a=` expr $a \+ $c `

x=` expr $x \/ 10 `

done

echo "Sum of digits is $a"...