+ 1
How to count total no. Of digits in an integer array?
2 Answers
+ 7
Hint:
- Prepare 2 variables totalDigits set to zero, and temp.
- Use a for loop (x) to enumerate the array elements.
- Inside for loop:
> Assign element[x] to temp.
> Use while loop with condition temp != zero.
> Inside while loop:
>> Increment totalDigits
>> Divide temp by 10
- Upon exiting the loop, display totalDigits
- Happy trying, and good luck!
Hth, cmiw
0
đŻđŻđŻ