I need to write a program that identifies the number of trailing zeroes in a number
ex. 1000 has 3 trailing zeroes and 1020 has 1 trailing zero..
I decided to set the limit between 1 and 100000. the only thing that I could think of is setting up a set of nested if statements like so
if (number < 100)
{
if (number%10 == 0)
cout << "the number has one trailing zero" <<endl;
the only thing is this can become quite repetetive as i am repeating the same steps for higher numbers..does anyone have any advice? i would greatly appreciate it
K
ex. 1000 has 3 trailing zeroes and 1020 has 1 trailing zero..
I decided to set the limit between 1 and 100000. the only thing that I could think of is setting up a set of nested if statements like so
if (number < 100)
{
if (number%10 == 0)
cout << "the number has one trailing zero" <<endl;
the only thing is this can become quite repetetive as i am repeating the same steps for higher numbers..does anyone have any advice? i would greatly appreciate it
K