帮我写一个计算月收入的c语言程序需要输入月基本工资和月提成
时间: 2023-03-26 11:03:54 浏览: 102
好的,我可以回答这个问题。以下是计算月收入的C语言程序:
#include <stdio.h>
int main() {
float basic_salary, commission, total_income;
printf("请输入月基本工资:");
scanf("%f", &basic_salary);
printf("请输入月提成:");
scanf("%f", &commission);
total_income = basic_salary + commission;
printf("月收入为:%.2f\n", total_income);
return ;
}
希望能帮到您!
相关问题
写一个C语言程序使任意输入一个月收入,计算当月应交纳的税额
#include<stdio.h>
int main()
{
float income, tax;
printf("请输入您的月收入:");
scanf("%f", &income);
if(income <= 0)
{
printf("您输入的月收入有误,请重新输入!\n");
return 0;
}
else if(income <= 5000)
{
tax = 0;
}
else if(income <= 8000)
{
tax = (income - 5000) * 0.03;
}
else if(income <= 17000)
{
tax = (income - 8000) * 0.1 + 900;
}
else if(income <= 30000)
{
tax = (income - 17000) * 0.2 + 2600;
}
else if(income <= 40000)
{
tax = (income - 30000) * 0.25 + 4600;
}
else if(income <= 60000)
{
tax = (income - 40000) * 0.3 + 9600;
}
else if(income <= 85000)
{
tax = (income - 60000) * 0.35 + 14600;
}
else
{
tax = (income - 85000) * 0.45 + 21600;
}
printf("您的月税额为:%.2f元\n", tax);
return 0;
}
帮我写一个计算工资的C语言代码
好的,以下是一个简单的计算工资的C语言代码:
#include <stdio.h>
int main() {
float hours, rate, salary;
printf("请输入工作小时数:");
scanf("%f", &hours);
printf("请输入每小时工资:");
scanf("%f", &rate);
salary = hours * rate;
printf("您的工资为:%.2f元\n", salary);
return ;
}
注意:此代码仅供参考,实际应用中可能需要考虑更多因素,如税收、社保等。