Thursday, October 13, 2011

IF Statement (Number 10)

Write a program that gives discount of 100 pesos to a costumer if shirt bought is XL and the price is greater than 500; a discount of 50 pesos if the shirt bought is large and the price is greater than 400.


 

(Solution)

#include<stdio.h>
#include<conio.h>
#define s scanf
#define p printf

int main()
{
    int PRICE, EKS;

    p("Choices:\n");
    p("1.] XL\n");
    p("2.] L\n");


    p("Enter T-Shirt Size: ");
    s("%d", &EKS);



    switch(EKS)

    {
    case 1:
   
         p("Enter Price: ");
         s("%d", &PRICE);
   
         if(PRICE>= 500)
     
         p("You Have Discount 100!");
   
         break;
   
   
   
   
    case 2:
              p("Enter Price: ");
              s("%d", &PRICE);
         
              if(PRICE >= 400)
         
              p("You have Discount 50!");
         
              break;
         
   
         default:
                  p("thank you!");
             
                  break;
                  }
         getch();
         return 0;
         }

0 comments:

Post a Comment