fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. /* variables definition */
  6.  
  7. float Price, SalesTax, Totalprice;
  8.  
  9. // "Enter the price in dollars:"
  10. printf ("Enter the Price in dollars:");
  11.  
  12. //Input Price
  13. scanf ("%f", &Price);
  14.  
  15. // Enter state sales tax(e.g. .06) :
  16. printf ("\nEnter State Sales Tax:");
  17.  
  18. //Input SalesTax
  19. scanf ("%f", &SalesTax);
  20.  
  21. //Calculate the Totalprice = Price + (Price * Salestax);
  22.  
  23. printf ("\nBefore Tax Price $%.2f \nState Sales Tax: %.2f(%)", Price, SalesTax);
  24. //TotalPrice = Price + (Price * SalesTax)
  25. Price = Price + (SalesTax/100 * Price);
  26.  
  27. //Write "Price with Tax is" + Price
  28. printf ("\nPrice with Tax: $%.2f", Price);
  29.  
  30.  
  31.  
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0s 10320KB
stdin
95.00
0.7
stdout
Enter the Price in dollars:
Enter State Sales Tax:
Before Tax Price $95.00 
State Sales Tax: 0.70(%)
Price with Tax: $95.67