#include<stdio.h>
float avg(float x,float y,float z)
{
float avg=(x+y+z)/3;
printf("average=%f",avg);
};
void main()
{
float phy,chem,bio;
printf("enter physics marks");
scanf("%f ",&phy);
printf("\n enter chemistry marks");
scanf("%f ",&chem);
printf("\n enter biology marks");
scanf("%f ",&bio);
avg(phy,chem,bio);
}
This program is find the average of three subject by the functions. But ,whenever I run this program it takes one extra value after giving input for physics variable.
What is the reason behind this problem and how do I solve this?