How to resolve the algorithm Sum digits of an integer step by step in the Ezhil programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Sum digits of an integer step by step in the Ezhil programming language

Table of Contents

Problem Statement

Take a   Natural Number   in a given base and return the sum of its digits:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Sum digits of an integer step by step in the Ezhil programming language

Source code in the ezhil programming language

# இது ஒரு எழில் தமிழ் நிரலாக்க மொழி உதாரணம்

# sum of digits of a number
# எண்ணிக்கையிலான இலக்கங்களின் தொகை

நிரல்பாகம் எண்_கூட்டல்( எண் )
  தொகை = 0
  @( எண் > 0 ) வரை
     d = எண்%10;
     பதிப்பி "digit = ",d
     எண் = (எண்-d)/10;
     தொகை  = தொகை  + d
  முடி
  பின்கொடு தொகை 
முடி


பதிப்பி எண்_கூட்டல்( 1289)#20
பதிப்பி எண்_கூட்டல்( 123456789)# 45


  

You may also check:How to resolve the algorithm String length step by step in the M2000 Interpreter programming language
You may also check:How to resolve the algorithm Top rank per group step by step in the OCaml programming language
You may also check:How to resolve the algorithm Singly-linked list/Element definition step by step in the Sidef programming language
You may also check:How to resolve the algorithm Happy numbers step by step in the DCL programming language
You may also check:How to resolve the algorithm Sum and product of an array step by step in the S-lang programming language