What is Algorithm Example
Example: Algorithm for counting the digits in a positive integer N.
Step 1. Set the Count to 0.
Step 2. Divide N by 10 (dropping any remainder).
Step 3. Add 1 to the Count.
Step 4. If N is greater than 0, repeat steps 2-4.
Step 5.Print N.
Step 6:Stop.
No comments:
Post a Comment