As you can see in C language I am trying to calcualte average . I want to know the logic about why after putting (float)(a,b,c) in function float average right below int main syntax it taking a,b,c as float instead of int
#include <stdio.h>
float average(int a, int b, int c);
int main(){
int a , b,c;
// I have taken a,b,c as int ;
printf("Enter the value of a\n");
scanf("%d",&a);
printf("Enter the value of b\n");
scanf("%d",&b);
printf("Enter the value of c \n");
scanf("%d",&c);
printf(" The value of average is %f",average(a,b,c));
return 0;
}
float average(int a, int b, int c){
float result;
result = (float)(a+b+c)/3; HERE I want to know its logic
return result;
}