Search This Blog

Friday, October 7, 2011

Suppose a shop keeper offers a discount of 20% if a customer's purchased amount exceeds Rs.2000, 15% if it exceeds 1000 and 10% if exceeds 500. Write a program to read gross amount and evaluate discount and display net amount Payable.

   1:  #include<stdio.h>
   2:  #include<conio.h>
   3:  void main()
   4:  {
   5:  float gross,dis;
   6:  printf("Enter the gross amount:");
   7:  scanf("%f",&gross);
   8:  dis=0.00;
   9:  if(gross>2000.00)
  10:  dis=0.20*gross;
  11:  else if(gross>1000.00)
  12:  dis=0.15*gross;
  13:  else if(gross>500.00)
  14:  dis=0.10*gross;
  15:  printf("Gross amount %8.2f\n",gross);
  16:  printf("Discount %8.2f\n",dis);
  17:  printf("net amount %8.2f\n",gross-dis);
  18:  getch();
  19:  }

No comments:

Post a Comment