Could you please run the following program c assignment and tell me if it is cor
ID: 3645431 • Letter: C
Question
Could you please run the following program c assignment and tell me if it is corrct and send back the results?My compiler is not working I cannot see of if has errors or if the program worked.
If errors, could you fix?
thnk you
#include<stdio.h>
int main()
{
int i;
float hours=0,rate=0,salary,sum=0.0,avg;
printf("Welcome to the Demont Salary calculator. ");
printf("This program will calculate the salary amounts for three employees ");
printf("after you have entered the hours and rates. ");
for(i=1;i<4;i++)
{
printf("Enter the number of hours for employee #%d: ",i);
scanf("%f",&hours);
printf("Enter the salary rate for employee #%d: ",i);
scanf("%f",&rate);
salary=hours*rate;
sum+=salary;
printf("*** The Salary for employee #%d is $%.2f ",i,salary);
}
printf("The total of the salaries for the 3 employees is $%.2f ",sum);
avg=sum/3.0;
printf("The average of the salaries for the 3 employees is $%.2f ",avg);
printf("Thanks for using the DeMont Salary program. ");
return 0;
}
Explanation / Answer
#include #include int main() { int i; float hours=0,rate=0,salary,sum=0.0,avg; printf("Welcome to the Demont Salary calculator. "); printf("This program will calculate the salary amounts for three employees "); printf("after you have entered the hours and rates. "); for(i=1;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.