Hi,I want to write a program that calculate the increment and new salary of employee based on the average of three evaluation points.(using pass by reference/pass by value). I've done the coding but the output is wrong. I think there's a mistake on the call function.
#include<stdio.h>
float get_increment(float *a);
float get_new_salary(float *salary);
float ave,percent,ns;
int main()
{
float i,j,total=0,ave,sum;
{
for(i=0;i<3;i++)
{
printf("Please enter three evaluations points:");
scanf("%f",&j);
total+=j;
printf("%.2f\n",total);
}
ave=total/3.00;
}
printf("%.2f\n",ave);
get_increment(&ave);
printf("The increment percentage is %.2f.\n",percent);
get_new_salary(&percent);
printf("The new salary is %.2f\n",sum);
}
float get_increment(float *a)
{
float percent;
if(ave>=2.00&&ave<=2.99)
{
percent=0.02;
}
else if(ave>=3.00&&ave<=3.99)
{
percent=0.04;
}
else if(ave>=4.00&&ave<=5.00)
{
percent=0.06;
}
return percent;
}
float get_new_salary(float *salary)
{
float ns,total,percent,pay,sum;
printf("Please enter your salary:\t");
scanf("%f",&pay);
ns=pay*percent;
sum=ns+pay;
return sum;
}