DEV Community

Anjali Chaturvedi
Anjali Chaturvedi

Posted on

Python Prowess: Day 3

I have decided to write simple C++ codes in Python 3 maybe that's the way I'll get to learn the language.

Code to calculate trailing zeros in a factorial n!

def trailingzeros(self,n):
   count=0
   i=5
   while(n/i>=1):
       count+= int(n/i)
       i*=5
   return int(count)
Enter fullscreen mode Exit fullscreen mode

🌼Please comment if you have any suggestions or encouraging words.🌼

Top comments (0)