PROGRAM
echo "Enter the Number :"
read number
n=$number
sum=0
while test $number -gt 0
do
rem=` expr $number % 10 `
sum=` expr $sum + $rem \* $rem `
number=` expr $number / 10 `
done
echo "The Sum Of Square Of Digits in the Given Number $n is $sum"
OUTPUT
Enter the Number :
12
The Sum Of Square Of Digits in the Given Number 12 is 5
echo "Enter the Number :"
read number
n=$number
sum=0
while test $number -gt 0
do
rem=` expr $number % 10 `
sum=` expr $sum + $rem \* $rem `
number=` expr $number / 10 `
done
echo "The Sum Of Square Of Digits in the Given Number $n is $sum"
OUTPUT
Enter the Number :
12
The Sum Of Square Of Digits in the Given Number 12 is 5
No comments:
Post a Comment