Question: I'm new to programming and I don't understand how to finish my C program. How do I make the calculator loop when the user enters

I'm new to programming and I don't understand how to finish my C program. How do I make the calculator loop when the user enters a 1 and quit when the user enters a 0?

 I'm new to programming and I don't understand how to finish

Also how do I do this function?

Bonus: Take a positive number (N) as an input (perform error check), print the numbers and calculate the sum of all numbers from 0 to N, also sum of all even numbers and sum of all odd numbers from 0 to N. (use for-loop)

Eg: Number is 4

0 1 2 3 4

Sum of all numbers is 10

Sum of even numbers = 6

Sum of odd numbers = 4

- int main(void) int option, units; while(1) displayMenu); printf('Choose a type of connection: ); scanf("%d", &option); if (errorCheck(option)) break; else printf("Invalid Choice! Please enter a valid choice '); while(1) printf("Enter the number of units (In kin):"); scanf("%d", &units); if (errorCheckUnits(units)) break; else printf(" Invalid input! Please enter a positive value '); //Calculations// float totalCharge - (float units + getRate(option, units)/100.0: printf("Total energy charge for the customer is %2f ", totalCharge); float totalBill - totalCharge + charge option): printf("Total Bill due from this connection is: %.21 ", totalBill); //Check for program loop// printf("Do you want to continue and calculate another bill? If yes enter 1, if not enter 0:"); scanf("%d", &option); while (option == 0){ break

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!