Loops in shell script

Hi,

I’m trying to implement a function using shell script to return sum of squares of digits

when i did to check for 1 iteration without loop it worked but when i add while loop it is showing command not found 0

please find the screenshot

please help me

Regards
Pradyumna

If you use already arithmetic expansion, you can use it also in the while condition.