Question: Using flowgorithm to chart with this code #include int main() { float prices[10]; float total = 0; float tax = 0; int numItems; int i;
Using flowgorithm to chart with this code
#include
int main() { float prices[10]; float total = 0; float tax = 0; int numItems; int i; char welcomeMessage[] = "Welcome to Hansen's Discount Supermarket!"; puts(welcomeMessage); printf("How many items do you have to scan: "); scanf("%d", &numItems); printf(" We are sorry the scanner is broke at the moment. Please enter your prices manually. "); for (i = 0; i < numItems; i++) { printf("What is the price of your product %d: ", i + 1); scanf("%f", &prices[i]); while (prices[i] > 10.00) { printf("Invalid price, Be sure to enter a price under $10.00: ", i + 1); scanf("%f", &prices[i]); } total += prices[i]; } printf(" Your total is: $%.2f. ",total); tax = total * 0.06; printf("Tax: $%.2f. ",tax); total += tax; printf("Your Grand total is: $%.2f. ", total); printf("Have a great day!"); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
