#include <stdio.h> int main() { float sum_salary=0,sum_raise=0,sum_newsalary=0; while(1) { float salary,rate,raise,newsalary; printf(\"Enter Salary :\"); scanf(\"%f\",&salary); if(salary==-1) { if(sum_salary==0) return 0; else { printf(\"Total Salary :%f Total raise :%f Total New...

70.2K

Verified Solution

Question

Programming

#include

int main()
{
float sum_salary=0,sum_raise=0,sum_newsalary=0;
while(1)
{
float salary,rate,raise,newsalary;
printf(\"Enter Salary :\");
scanf(\"%f\",&salary);
if(salary==-1)
{
if(sum_salary==0)
return 0;
else
{
printf(\"Total Salary :%f Total raise :%f Total New Salary:%f\",sum_salary,sum_raise,sum_newsalary);
return 0;
}

}
else
{
if(salary>=0 &&salary<30000)
rate=7;
else if(salary>=30000 &&salary<=40000)
rate=5.5;
else if(salary>40000)
rate=4;
raise=rate*salary/100;
newsalary=salary+raise;
  
sum_salary=salary+sum_salary;
sum_raise=raise+sum_raise;
sum_newsalary=newsalary+sum_newsalary;
printf(\"Salary :%f rate :%f Raise :%f New Salary:%f\n\",salary,rate,raise,newsalary);

}
}
}

Hi can you please make sure that the following program will askthe user the following question before the salaries are entered? Iam not sure where I would have to add this in for it ask that. Ifyou can fit this requirement in the program that will be greatlyappreciated. Thank you

Here is the question that the program should ask, \"Howmany salaries do you want to enter?\"

Answer & Explanation Solved by verified expert
4.5 Ratings (763 Votes)
Source code of the program after changes made and its explanation are given belowChanges are shown in bold caseScreen    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students