Computer Science, asked by deekshupatel, 18 days ago

write a c program using switch and if statements to compute the net amount to be paid by the customer to the cloth showroom based on purchase amount and discount. Purchase amount 0-100, 101-200, 201-300, above 300; DISCOUNT (mill cloth) : -- , 5%, 7.5%, 10% DISCOUNT (Handloom items): 5%, 7.5%, 10%, 15%. ​

Answers

Answered by abmatt1020
2

Answer:

#include <stdio.h>

void main()

{

int choose, p_amt,pay,discount;

clrscr();

printf("Enter your catagory 1 for mill cloth\n2 for Handloom items and\

purchase amount");

printf("\n0 for End:");

input:

scanf("%d %d",&choose,&p_amt);

if(choose==0)

goto end;

switch(choose)

{

case 1: if(p_amt<=100)

discount=0;

else if(p_amt<=200)

discount=p_amt*0.05;

else

if(p_amt<=300)

discount=p_amt*0.075;

else

if(p_amt>300)

discount=p_amt*0.10;

break;

case 2: if(p_amt<=100)

discount=p_amt*0.05;

else if(p_amt<=200)

discount=p_amt*0.075;

else

if(p_amt<=300)

discount=p_amt*0.10;

else

if(p_amt>300)

discount=p_amt*0.15;

break;

default: printf("Error in choise");

goto end;

}

pay=p_amt-discount;

printf("You have to pay %d",pay);

goto input;

end:

printf("End of Program!");

getch();

}

Explanation:

Similar questions