Write a program to store product ID and sales ammount and calculate discount accordin to condition and calculate net ammount

Take Product ID and Sales ammount from user.
Calculated Discount ammount according to condition:
If amt < 5000 then discount = 20%
If ammount >= 5000 And <= 10000 then discount = 30%
otherwise discount= 40%

Select To use this code as it is.. select and copy paste this code into code.cpp file :)



  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. float id,amt,pd,d,net;
  7. cout<<"Please enter product ID: ";
  8. cin>>id;
  9. cout<<"Please enter Sales ammount: ";
  10. cin>>amt;
  11. if (amt<5000)
  12. d=.2*amt;
  13. else if (amt>=5000 && amt<=10000)
  14. d=.3*amt;
  15. //Coding by: Snehil Khanor
  16. //http://WapCPP.blogspot.com
  17. else
  18. d=.4*amt;
  19. net=amt-d;
  20. cout<<"Discount= "<<d;
  21. cout<<"\nNet ammount= "<<net;
  22. getch();
  23. }

Check out this stream