clear echo "Enter number:" read no; count=0 total=0 while [ $no -ne 0 ] do a=`expr $no % 10` no=`expr $no / 10` total=`expr $total + $a` count=`expr $count + 1` done if [ `expr $no % 2` -eq 0 ]; then echo "NUMBER IS EVEN" else echo "NUMBER IS ODD" fi echo "SUM OF ALL DIGITS:$total" echo "TOTAL NUMBER OF DIGIT:$count"
0 comments:
Post a Comment