Professional Documents
Culture Documents
PRACTICAL NO: 3
Definition: Take any number from the user. Get each and every digit one by one and make addition
of that to find the sum of digits of a given number. E.g. if user has entered 342 then the sum of digits
is 3+4+2 = 9.
Flowchart:
Sample Code:
a=0
while [ $a -lt 10 ]
do
echo $a
a=`expr $a + 1`
done
Input: -
Flowchart:
Sample Code:
sum=0
echo $sum
Note: -gt=greater than, -lt=less than
OUTPUT: