Sunteți pe pagina 1din 3

parolaValida="secret"

echo "Introduceti parola:"


read inputPw
if [ "$parolaValida" == "$inputPw" ]
then
echo -n "Succes!"
echo -n " Introduceti un numar mai mare de 100: "
read num
if [ "$num" -lt 100 ]
then
echo "Nu va incadrati cerintelor!"
fi
echo
echo "$(tput setaf 6) 1)Nr par/nr impar"
echo "$(tput setaf 4) 2)"
read CHOICE
case $CHOICE in
1) echo "Doriti sa aflati daca numarul este par sau impar"
r=$(($num % 2))
if [ $r -eq 0 ]
then
tput bold
echo "$(tput setaf 3)Numarul $num este un numar par"
for (( i=1; i<=3; i++ ))
do
for (( j=1; j<=i; j++ ))
do
echo -n "|Numarul $num"
done
echo " este par"
done
for (( i=3; i>=1; i-- ))
do
for (( j=1; j<=i; j++ ))
do
echo -n "|| PAR"
done
if [ $i -eq 3 ]; then
echo -n "$num"
echo -n -e ">>$(tput setaf 4) Numarul $num este par"
else

echo "$(tput setaf 4) PAR"


fi
done
else
echo "$(tput setaf 5) Este un numar impar"
for (( i=1; i<=3; i++ ))
do
for (( j=1; j<=i; j++ ))
do
echo -n "|PAR"
done
echo "______"
done
for (( i=3; i>=1; i-- ))
do
for (( j=1; j<=i; j++ ))
do
echo -n "||Numarul "
done
if [ $i -eq 3 ]; then
echo -n "este impar"
echo -n -e ">> Numarul este IMPAR <<"
else
echo "IMPAR"
fi
done
fi
;;
2) echo "Doriti sa aflati inversul numarului."
echo "Usage: $0 number"
echo "
I will find sum of all digit for given number"
echo "
For eg. $0 123, I will print 6 as sum of all digit (1+2+3)"
exit 1
sum=0
sd=0
while [ $num -gt 0 ]
do
sd=`expr $num % 10`
sum=`expr $sum + $sd`
n=`expr $num / 10`
done
echo "Sum of digit for numner is $sum"

;;
*) echo "Optiune ilegala"
exit
;;
esac
fi
f