Home Forums C Programming price and size

Viewing 1 reply thread
  • Author
    Posts
    • #2062
      fshabeer
      Participant

      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…

    • #3323
      Humayan
      Participant

      You could do :
       

      enum size { XL , L }  
      if ( tShirtWorth > 500 && size == XL )
      {
          discount = 100;
      }
      else if ( price > 400 && size == L )
      {
         discount = 50;
      }

       
       
      if you just needed the logic……

Viewing 1 reply thread
  • The forum ‘C Programming’ is closed to new topics and replies.