sum of the digits of a given number


algorithm :


Step 1:  Input N
Step 2:  Sum = 0
Step 3:  While (N != 0)
                        Rem = N % 10;
                        Sum = Sum + Rem;
                        N = N / 10;
Step 4:  Print Sum

Share on Google Plus

About Vishnuprasad AS

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment