Write a program to count the number of digits that end with the digit in
Answers
Answered by
1
Answer:
C Program to Count Number of Digits in an Integer
Program to Count the Number of Digits Then the while loop is iterated until the test expression n! = 0 is evaluated to 0 (false). After the first iteration, the value of n will be 345 and the count is incremented to 1. After the second iteration, the value of n will be 34 and the count is incremented to
Answered by
0
Explanation:
Logic to count number of digits in an integer
Input a number from user. ...
Initialize another variable to store total digits say digit = 0 .
If num > 0 then increment count by 1 i.e. count++ .
Divide num by 10 to remove last digit of the given number i.e. num = num / 10 .
Repeat step 3 to 4 till num > 0 or num !=
Similar questions