Adp 2b
Adp 2b
2 B
AIM:
ALGORITHM:
1. Start
3.5 If choice is 5, write a shell program to find the sum of the digits of a
given number.
1. Start
PROGRAM:
echo "MENU"
read choice
case $choice in
1)
read n
f=1
j=0
echo "$j"
echo "$f"
do
k=$((j + f))
j=$f
f=$k
echo "$k"
done
;;
2)
read n
if (( n % 2 == 0 )); then
else
fi
;;
3)
read year
else
fi
;;
4)
read a b c
fi
;;
5)
read num
sum=0
temp=$num
digit=$((temp % 10))
sum=$((sum + digit))
temp=$((temp / 10))
done
;;
*)
;;
esac
while true; do
echo "MENU"
read choice
case $choice in
1)
read file
cat "$file"
;;
2)
read s
read d
cp "$s" "$d"
;;
3)
read s
read d
mv "$s" "$d"
;;
4)
read file
wc "$file"
;;
5)
read file
read option
read word
;;
6)
read file
read n
;;
7)
read file
read n
;;
8)
read file
read option
sort $option "$file"
;;
*)
;;
esac
done
1. FIBONACCI :
OUTPUT :
1. CAT :
2. CP :
3. MV :
4. WC :
5. GREP :
6. HEAD :
7. TAIL :
8. SORT:
RESULT: