#!/bin/bash echo "enter" read num rev=0 even=0 odd=0 while [ $num -gt 0 ] do tmp=$(( $num % 10 )) if(( $tmp % 2 == 0 )) then even=$(( $even + $tmp )) else odd=$(( $odd + $tmp )) fi rev=$(( $rev * 10 + $tmp )) num=$(( $num / 10 )) done echo the sum of even number $even echo the sum of odd number $odd
To embed this project on your website, copy the following code and paste it into your website's HTML: