Can't figure out why my C program isn't working.
Need to write a program that calculates weekly salary of each salesperson until -1 is entered.
Here's my code:
#include int main(void){float sales=0;while (sales != -1){printf("Enter sales in dollars (-1 to end): "); // prompt user for inputscanf("%f\n", &sales); // obtain valuefloat salary;salary = (sales * .09) + 200; // calculates salaryprintf("Salary is: $ %.2f\n", salary); // give salary amount to user}return 0; //end program}Extracted text: tinclude int main(void) { float sales=0; while (sales != -1) {printf("Enter sales in dollars (-1 to end): "); // prompt user for input scanf("%f\n", &sales); // obtain value float salary; salary = (sales * .09) + 200; // calculates salary printf("Salary is: $ %.2f\n", salary); // give salary amount to user } return 0; //end program
int main(void){float sales=0;while (sales != -1){printf("Enter sales in dollars (-1 to end): "); // prompt user for inputscanf("%f\n", &sales); // obtain valuefloat salary;salary = (sales * .09) + 200; // calculates salaryprintf("Salary is: $ %.2f\n", salary); // give salary amount to user}return 0; //end program}
Extracted text: tinclude int main(void) { float sales=0; while (sales != -1) {printf("Enter sales in dollars (-1 to end): "); // prompt user for input scanf("%f\n", &sales); // obtain value float salary; salary = (sales * .09) + 200; // calculates salary printf("Salary is: $ %.2f\n", salary); // give salary amount to user } return 0; //end program
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here