//Exam 1 with Loop For //Problem 3 /* The user shops in 3 different online stores. Store 1 charges 2% of the purchase for shipping, store 2 charges 3% of the purchase for shipping, and store 3 has the following rule: shipping is free for all purchases $35 or above, and $2.99 otherwise. Write a program that first reads the number of purchases the user made in one day, then, for each purchase, the program reads the purchase price and the store indicator (1, 2, or 3). The program finds and prints the total shipping charges the user paid in one day. Assume, the input is valid */ #include int main(){ int purchases,store,i; float price,shipping=0; printf("how many purchases were made in one day?\n"); scanf("%d",&purchases); if(purchases>0){ for(i=1;i<=purchases;i++){ printf("enter price of item %d\n$",i); scanf("%f",&price); printf("enter the store indicator (1, 2, or 3)\n"); scanf("%d",&store); if(store==1){ shipping+=price*0.02; } else if(store==2){ shipping+=price*0.03; } else if(store==3 && price<35){ shipping+=2.99; } } printf("the total shipping charges paid is $%.2f\n",shipping); } else{ printf("invalid input entered\n"); } return 0; }