Home > OS >  How would I write this if statement
How would I write this if statement

Time:03-28

The condition is that a product gets a discount if it is bought on september 15th through october 15th. How would I write an if statement for this?

You could start off with:

if ((month != 9 || month != 10) && (day....

CodePudding user response:

I would say:

if (month == 9 && day >= 15) || (month == 10 && day <=15)

CodePudding user response:

if((month == 9 && day >= 15) || (month == 10 && day <= 15)) { }

CodePudding user response:

if ((month == 9 && day >= 15) || (month == 10 && day <= 15))
  • Related