FCTRL - Factorial - SPOJ Solution C++

  Problem Link : FCTRL  


👉 Hint : edit please

 


✅ C++ Solution :

 
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll n,ans=0;
		cin>>n;
		ll l=5;
		while(n/l>0)
		{
		    ans+=n/l;
		    l*=5;
		}
		cout<<ans<<endl;
	}
}

 

Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook. 

😇Happy Learning!!