Calculate average of numbers using function
#include<iostream.h>
#include<conio.h>
int average(int,int,int)  ;
void main()
{
int a,b,c,d;
cout<<"Enter 3 numbers : "<<endl;
cin>>a>>b>>c;
d=average(a,b,c);
cout<<endl<<"Average is : "<<d;
getch();
}
int average(int x, int y, int z)
{
int s;
s=(x+y+z)/3;
return s;
}
For Further Reading,
0 comments:
Post a Comment