- This topic has 1 reply, 2 voices, and was last updated 16 years, 7 months ago by .
Viewing 1 reply thread
Viewing 1 reply thread
- The forum ‘C Programming’ is closed to new topics and replies.
Home › Forums › C Programming › price and size
i just want to ask the code of this problem: if you buy a t-shirt worth of more than 500 and the size is XL, you will have a discount of 100 if the price is more than 400 and the size is L, you have a 50 discount…
You could do :
1 2 3 4 5 6 7 8 9 | enum size { XL , L } <br /> if ( tShirtWorth > 500 && size == XL )<br /> {<br /> discount = 100;<br /> }<br /> else if ( price > 400 && size == L )<br /> {<br /> discount = 50;<br /> } |
if you just needed the logic……