Skip to content

Instantly share code, notes, and snippets.

@isaacssemugenyi
Created March 8, 2023 10:33
Show Gist options
  • Save isaacssemugenyi/fddccb15ed5270c0f635f4e7118a2a44 to your computer and use it in GitHub Desktop.
Save isaacssemugenyi/fddccb15ed5270c0f635f4e7118a2a44 to your computer and use it in GitHub Desktop.
/*A program to compute for total taxes and total cost of a car
*@ authors [Asiimwe Prisca, Isaac Ssemugenyi]
*/
#include<stdio.h>
int main(){
// Declare all required variables
float dutiable_value, import_duty, value_added_tax, import_commission;
float withholding_tax, environment_tax, total_cost, total_tax;
// Message to instruct user on the input
printf("Input dutiable value in UGX,");
// Get the dutiable value from user
scanf("%f", &dutiable_value);
// Calculate for import duty
import_duty = 0.15 * dutiable_value;
// Calculate for value added tax
value_added_tax = 0.17 * import_duty;
// Calculate for import commision
import_commission = 0.02 * dutiable_value;
// Calculate for withholding tax
withholding_tax = 0.04 * dutiable_value;
// Calculate for environment tax
environment_tax = 0.2 * dutiable_value;
// Calculate for total tax
total_tax = import_duty + withholding_tax + environment_tax + import_commission + value_added_tax;
// Print out the total tax charged
printf("\n The total taxes charged are UGX %.2f\n", total_tax);
// Calculate for total cost of the car
total_cost = dutiable_value + total_tax;
// Print out the total cost of the car
printf("\n The total cost of the car is UGX %.2f", total_cost);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment