Skip to content
Home » Simple C Program to Find the Total Cost of the Vehicle

Simple C Program to Find the Total Cost of the Vehicle

Learn about Simple C Program to Find the Total Cost of the Vehicle in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Simple C Program to Find the Total Cost of the Vehicle

Program:

#include<stdio.h>
int main()
{
  double amount, tax, cost;
  int ed, salesTax, oc, roadTax;
  ed=15, salesTax=10, oc=5, roadTax=1;

  printf("Enter total amount: ");
  scanf("%lf",&amount);
  tax = amount*(ed+salesTax+oc+roadTax)/100;
  cost = amount + tax;

  printf("Total Cost = %.lf",cost);

  return 0;
}

Output:

Enter total amount: 12000
Total Cost = 15720

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
Finding the Number of Conversion Characters in scanf Function in C
C Program to Display Equivalent Octal and Hexadecimal Value