# Program to find average of three numbers using function in C C++

## Program to find average of three numbers using function in C C++

C-Language में function recursion किसे कहते है और इसकी क्या उपयोगिता है जानने के लिए देखें— Recursion in C

Function में call by value और call by reference क्या होता है जानने के लिए देखें—Call by value and reference

C Language में Pointer क्या प्रयोग करते हुए किसी Function को कैसे point किया जा सकता है जानने के लिए देखें—Pointer to function

### Program to find average of three numbers using function in C

#include<stdio.h>
float avg(int,int,int);
int main()
{
int a,b,c;
printf("Enter three numbers: ");
scanf("%d%d%d",&a,&b,&c);
printf("Average of numbers = %f",avg(a,b,c));
return 0;
}
float avg(int x, int y, int z)
{
return (x+y+z)/3.0;
}

### Program to find average of three numbers using function in C++

#include<iostream>
using namespace std;
float avg(int,int,int);
int main()
{
int a,b,c;
cout<<"Enter three numbers: ";
cin>>a>>b>>c;
cout<<"Average of numbers = "<<avg(a,b,c);
return 0;
}
float avg(int x, int y, int z)
{
return (x+y+z)/3.0;
}

Share it to: