Write a program in C to demonstrate switch case
#include <stdio.h>
void main()
{
int,ch qty;
long tb,dis,nb;
clrscr();
printf("1.BPL\n2.Onida\n3.Sony\n4.Samsung\n5.LG\n");
printf("\nEnter Your Choice: ");
fflush(stdin);
scanf("%d",&ch);
printf("Enter Qty: ");
scanf("%d",&qty);
switch(ch)
{
case 1:tb=(long)qty*10000;
printf("\nBPL is %ld",tb);
break;
case 2:tb=(long)qty*12000;
printf("\nOnida is %ld",tb);
break;
case 3:tb=(long)qty*11500;
printf("\nSony is %ld ",tb);
break;
case 4:tb=(long)qty*11000;
printf("\nSamsung is %ld ",tb);
break;
case 5:tb=(long)qty*13000;
printf("\nLG is %ld ",tb);
break;
Default:
printf("Wrong Choice...");
}
dis=(tb*10)/100;
nb=tb-dis;
printf("\nDiscount is %ld",dis);
printf("\nNet bill is %ld",nb);
getch();
}
Post a Comment