Hi guys .. My program is working however instead of putting the assigning f=='x' it must xl -- HOWEVER when i used xl the computation goes wrong .. what shoud i do .. THANKS in ADVANCE
Code:
#include<stdio.h>
#include<conio.h>
void main()
{
char f;
int s_price, disc, t_price;
clrscr();
printf(" \n\tEnter the Shirt Size (X,L,M,S): ");
scanf("%c",&f);
printf(" \n\tEnter the The Price of Shirt: ");
scanf("%d",&s_price);
if (f=='x' && s_price>=500)
t_price=s_price+100;
if (f=='x' && s_price<500)
t_price=s_price;
if (f=='l' && s_price>=400)
t_price=s_price+50;
if (f=='l' && s_price<400)
t_price=s_price+0;
if (f=='m' || f=='s'&& s_price>0)
t_price=s_price+0;
{
if (f=='x' && s_price>=500)
printf(" \n\n\tThe Discount is : 100");
else if (f=='x' && s_price<500)
printf(" \n\tNo Discount ! Purchase atleast 500php ");
else if (f=='l' && s_price>=400)
printf(" \n\n\tThe Discount is : 50");
else if (f=='l' && s_price<400)
printf(" \n\tNo Discount ! Purchase atleast 400php ");
else if (f=='m' || f=='s')
printf(" \n\tThe Discount is only for XL and Large Shirts ");
}
printf(" \n\n\tThe Total Price is: %d",t_price);
getch();
}
Comment