Factorial Trailing Zeros

i have no idea why my code give me WA , please help :confused:

#include
#include
#include <math.h>

using namespace std;

int main() {

unsigned int t, num, pnum , total , one = 1 , zero = 0;

cin >> t;

for (int x = 0; x < t; x++){

	cin >> num;

	pnum = 0;
	total = 0;

	if (num > 5){

		for (int y = 1; y < 30; y++){

			if (pow(5, y) < num && pow(5, y + 1) > num){
				pnum = y;
				break;
			}
		}


		for (int z = 1; z <= pnum; z++){

			total = total + (num / pow(5, z));
		}


		cout << total << endl;

	}


	if (num == 5){
		cout << one << endl;
	}

	if (num < 5 && num >= 1){
		cout << zero << endl;
	}


}

return 0;

}