本文主要是介绍用C语言编程写销售佣金计算器、利息计算器,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
#include<stdio.h>
int main(void)
{
//销售佣金计算器unsigned int x=200;//定义x为底薪float sum;//定义sum为销售总额 float salary;//定义salary为薪水 printf("Enter sales in dollars (-1 to end):");scanf("%f",&sum);while(sum!=-1){salary=0.09*sum+x;printf("Salary is : $ %0.2f\n",salary);printf("\nEnter sales in dollars (-1 to end):");scanf("%f",&sum);}
}
销售佣金计算器:某大型化学药品公司以销售员的佣金为基础来支付其工资。销售员每周的工资是¥200的底薪,加上该周销售额的9%。请编写这样一个程序:输入每位销售员上周的销售总额,计算并显示他们的收入。每次只处理一名销售员的数据。
运算结果:
利息计算器:贷款的利息公式:利息=本金*利率*天数/365
请开发一个程序:读入若干比贷款的本金、利率和借贷天数,使用上面的公式计算并显示每笔贷款的利息。
#include<stdio.h>
int main(void)
{//利息计算器 float principal;float rate;int days;float interest;printf("Enter loan principal (-1 to end): ");scanf("%f",&principal);while(principal!=-1){printf("Enter interest rate: ");scanf("%f",&rate);printf("Enter term of the loan in days: ");scanf("%d",&days);interest=principal*rate*days/365;printf("The interest charge is $ %.2f\n\n",interest);printf("Enter loan principal (-1 to end): ");scanf("%f",&principal);}
}
利息计算器运算结果:
这篇关于用C语言编程写销售佣金计算器、利息计算器的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!