Help with excluding numbers

Hello. Can someone please help me with my code? So I have to write a code that does factorials but excludes even numbers from the facrorial. Like 3! would be 4 not 6. I have written the code for the facrorial but I don't know how to exclude the even numbers. I know to use if(n%2==0) but I'm not sure what to do after that. If someone could help, I would really appricate it. Thank you!

#include <iostream>
using namespace std;
int factorial(int n);
int main ()
{
int x;
int fact;
cin >> x;
fact=factorial(x);
if(x <= 0)
{
cout << "0" << endl;
}
else
{
cout << fact << endl;
}
return 0;
}
int factorial(int n)
{
int product = 1;
while (n > 0)
if(n%2==0)
{
//I don’t know what to do here.
}
{
product = n * product;
n--;
}
return product;
}
Just make it so you don't multiply if it's an even number. Example:
1
2
3
4
5
6
7
8
9
10
11
int factorial(int n) {
    int product = 1;
    while (n > 0) {
        if (n % 2 == 1) {
            // odd number
            product *= n;
        }
        --n;
    }
    return product;
}
Oh okay. Thank you very much!
Topic archived. No new replies allowed.