Question
I need a Flowchart for this code: int main() { // main method printf( tWelcome to the Best Friend Dog Rescue Charity Night at the
I need a Flowchart for this code:
int main() { // main method printf(" \tWelcome to the Best Friend Dog Rescue Charity Night at the Movies!"); printf(" \tTicket Sales for Adults: "); int adult[6], child[4],expenses[5]; // decleration of arrays to store the respective price. int adult_total=0, child_total=0, expenses_total=0, charity=0, total_ticket=0; // variables to store the total respective prices. int i; for(i=1;i<=6;i++){ // for loop to get the price of adult tickets printf("\tAdult Ticket Price: $"); scanf("%d", &adult[i]); // storing the user input to the respective array } for(i=1;i<=6;i++){ // for loop to calculate the total. adult_total=adult_total+adult[i]; } printf(" \tTotal Adult Tickets sales are $%d", adult_total); // showing the total. printf(" \tTicket Sales for Children: "); for(i=1;i<=4;i++){ // for loop to get the price of child tickets printf("\tChild Ticket Price: $"); scanf("%d", &child[i]); // storing the user input to the respective array } for(i=1;i<=4;i++){ // for loop to calculate the total. child_total=child_total+child[i]; } printf(" \tTotal Child Tickets sales are $%d", child_total); // showing the total. printf(" \tSnack Sales: "); for(i=1;i<=5;i++){ // for loop to get the price of printf("\tSnack Prices: $"); scanf("%d", &expenses[i]); // storing the user input to the respective array } for(i=1;i<=5;i++){ // for loop to calculate the total. expenses_total=expenses_total+expenses[i]; } printf(" \tTotal Snack sales are $%d", expenses_total); // showing the total. total_ticket=adult_total+child_total+expenses_total; // calculating the total sales of tickets printf(" \tTotal Tickets Sales are $%d",total_ticket); // showing the total sale. charity=total_ticket*0.45; // calculating the charity percentage as 45% i.e 0.45 of total sale. printf(" \tThe Total donation for the Charity Event is $%d", charity); // showing the charity return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started