/*To find the average using function*/
#include<stdio.h>
#include<conio.h>
void main()
{
float avg(float,float);
float a,b,c;
clrscr();
printf("Enter the value ofa&b::\n");
scanf("%f%f",&a,&b);
c=avg(a,b);
printf("\n Avg is %f",c);
getch();
}
float avg(float a,float b)
{
float d;
d=(a+b)/2;
return(d);
}
/* Enter the value ofa&b::
2
3
Avg is::2.500000*/
No comments:
Post a Comment