Showing posts with label WAP to find out Total Bill with discount according to conditions (Ternary Operators). Show all posts
Showing posts with label WAP to find out Total Bill with discount according to conditions (Ternary Operators). Show all posts

TOTAL BILL/ DISCOUNT A

WAP to find out Total Bill with discount according to conditions (Ternary Operators)

void main ()

{

int b,dis,n;

clrscr ();

printf ("Enter Bill: ");

scanf ("%d",&b);

dis=(b<500)?(b*.10):(b>=500 &&amp; b<1000)?(b*.15):(b>=1000 && b<=2000)?(b*.20):(b*.25);

n=b-dis;

printf ("Net Bill is %d",n);

getch();

}

Labels