In the space provided below write a C program that computes the total cost of items you want to order online. It does so by first asking how many items are in your shopping cart and then based on that number, it repeatedly asks you to enter the cost of each item.
It then adds a 5% delivery charge for standard delivery if the total is BELOW $1000, and an additional 10% charge if you want expedited shipping.
include screenshots demoing the execution of the program
use proper c language
re-write code when applicable
point out errors
So I’ve wrote my code here but I keep getting a syntax error message. Can you please clarify in your answer what I did wrong.
the error message I get is:
main.c: In function ‘main’:
main.c:45:1: error: ‘else’ without a previous ‘if’ else if( yes == 1 ) ^~~~
int items, i, yes = 1, no = 0;
double standardShip = 0.05, fastship = 0.1, totalCost, cost;
printf(“How many items are in your cart?n”);
for (i=1; i <=items; i++)
printf(“Enter total cost of itemsn”);
scanf(“%lf” , &cost);
totalCost = totalCost + cost;
printf(“You will be charged regular shippingn”);
printf(“Your new total is:%lfn” , totalCost);
else if( yes == 1 )
printf(“Please enter 1 for fast shippingn”);
scanf(“%d” , &yes);
printf(“You will be charged extra for expedited shipping”);
printf(“Your new total is: %lfn”, totalCost);
printf(“Your total is: %lf” , totalCost);
"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you A results."