I have a couple of questions, both regarding IF.
I'm using Turboc to compile the program if its worth mentioning btw.
The first one- the assignment is this-
Someone rolls a dice, the score is determined like this-
if its an odd number, his score would be the dice * 2. (3*2=score=6)
if its an even number, his score would be the dice * 2 + 1 (4*2+1=score=9).
Now, I googled it many times and I got the same code,
And everything works, I got my result as I expected, but would someone explain me how this works?
printf("enter your dice's score");
printf("you total score is: %d",total_score);
printf("your total score is: %d",total_score);
Especially that '%2' part, what does it do? didn't find an explanation for this one.
I basically need to know how do I tell the program if X is bigger than 500, but is smaller than 1000 (500<X<1000), then do a certain thing.
if you buy something in a store that cost more than 500$, you get a 5% discount. but if you buy something for 1000$, you get 10% discount.
Obviously the 500<X<1000 didn't work, so I came here. x.x
hope everything is clear enough, thanks in advance,