C Programming- C Program to Count Number of Digits in an Integer

Published: 12 February 2023
on channel: Jayant Tripathy
465
3

#cprogramming #shorts
C Program to Count Number of Digits in an Integer

Enter an integer: 3452
Number of digits: 4

The integer entered by the user is stored in variable n. Then the do...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 2.
After the third iteration, the value of n will be 3 and the count is incremented to 3.
After the fourth iteration, the value of n will be 0 and the count is incremented to 4.
Then the test expression of the loop is evaluated to false and the loop terminates.


Watch video C Programming- C Program to Count Number of Digits in an Integer online without registration, duration hours minute second in high quality. This video was added by user Jayant Tripathy 12 February 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 465 once and liked it 3 people.