Write a C program to calculate the total cost of the vehicle

 TASK-

Write a program to calculate the total cost of the vehicle by adding basic cost with
 (i) excise duty (15%)
 (ii) sales tax (10%) 
(iii) octroi (5%) 
(iv) road tax (1%).
 Input the basic cost by user.

CODE:

#include<stdio.h> 

int main(){

//% to be fixed e.g excise duty is 15% of basic hence it should be declared with 15/100=0.15 

float basic_cost,excise_duty=0.15,sales_tax=0.1,octroi=0.05,road_tax=0.01;

printf("Enter the basic cost of vehicle: ");

scanf("%f",&basic_cost);

excise_duty=excise_duty*basic_cost;

sales_tax=sales_tax*basic_cost;

octroi=octroi*basic_cost;

road_tax=road_tax*basic_cost;

printf("\nTotal cost after taxation = %0.2f",basic_cost+excise_duty+sales_tax+octroi+road_tax);

getchar();

return 0;

}


NEED WORK PRODUCE WORK

My name is Abdul Rehman I am from Pakistan. I am doing BS in Computer and information sciences. Currently, I am creating these blogs to help students of computer sciences all over the world..

3 Comments

Post a Comment
Previous Post Next Post