Write a C function (NOT A COMPLETE PROGRAM)which takes three parameters which are the cost for an item in a grocery store, the quantity to buy, and the tax percentage. The function should calculate and returnthe following values:i. The cost before the tax amount(cost* quantity)ii. The taxamount (the cost before the tax amount* tax% / 100)iii. The cost with the tax amount(the cost before the tax amount the tax amount) for the item.

Respuesta :

Answer:

Check the explanation

Explanation:

#include <stdio.h>

void CalculateTotal(float cost,int quantity,int tax){

  float costbeforetax=cost*quantity;

  printf("\nTotal Cost Before Tax %f is ",costbeforetax);

  float taxamount=(costbeforetax*tax)/100;

  printf("\n Tax amount %f is ",taxamount);

  float total=costbeforetax+taxamount;

  printf("\n Total amount after Adding Tax %f is ",total);

}

int main()

{

  float cost;

  int quantity,tax;

  printf("Enter Cost of Item ::");

  scanf("%f",&cost);

  printf("Enter Quantity of Item ::");

  scanf("%d",&quantity);

  printf("Enter Tax in % ::");

  scanf("%d",&tax);

  CalculateTotal(cost,quantity,tax);

  return 0;

}

/*

The Output will look like this:

Enter Cost of Item ::10

Enter Quantity of Item ::5

Enter Tax in % ::23

Total Cost Before Tax 50.000000 is

Tax amount 11.500000 is

Total amount after Adding Tax 61.500000 is

*/