C语言问题

A large chemical company pays its sales staff on a commission basis. They receive □200 per week plus 9% of their gross sales for that week. For example, someone who sells □5000 of chemicals in one week will earn □200 plus 9% of □5000, a total of □650. Develop a C program that will input each salesperson’s sales for the previous week, and print out their salary. Process one person’s figures at a time.

Enter sales in pounds (-1 to end): 5000.00
Salary is: 650.00

Enter sales in pounds (-1 to end): 00.00
Salary is: 200.00

Enter sales in pounds (-1 to end): 1088.89
Salary is: 298.00

Enter sales in pounds (-1 to end): -1

#include<stdio.h>
void main()
{
    float input = 0;
    while(input != -1)
    {
        printf("Enter sales in pounds (-1 to end): ");
        scanf("%f", &input);
        if (input != -1)
        {
            printf("Salary is: %.2f\n\n", (input*0.09 + 200));
        }
    }
}

温馨提示:答案为网友推荐,仅供参考