Write a program to count the number of vowels in a given string.

clear
echo "Entre a string to find the number of Vowels "
read st
len=`expr $st | wc -c`
len=`expr $len - 1`
count=0
while [ $len -gt 0 ]
do
ch=`expr $st | cut -c $len`
case $ch in

[aeiou,AEIOU]) count=`expr $count + 1` ;;
esac
len=`expr $len - 1`
done
echo "Number of vowels in the give string is $count"

OutPut

Entre a string to find the number of Vowels
AbcefuSI
Number of vowels in the give string is 4

1 comment:

  1. We are urgently in need of KlDNEY donors for the sum of $500,000.00 USD, Email for more details:
    hospitalcarecenter@gmail.com
    WhatsApp +91 779-583-3215

    ReplyDelete