Friday, 4 November 2016

Q. WAF to calculate average of 3 nos.

#include<conio.h>
#include<iostream.h>
int avg(int a,int b,int c);
void main()
{
clrscr();
int w,x,y,z;
cout<<"Enter three nos. ";
cin>>w>>x>>y;
z=avg(w,x,y);
cout<<"Average = "<<z;
getch();
}
int avg(int a,int b,int c)
{
int z;
z=(a+b+c)/3;
return(z);
}

No comments:

Post a Comment

Basic Implementation of Array as a Pointer

#include<iostream.h> #include<conio.h> void main() { clrscr();   int arr[5];   cout<<"Enter 5 nos. ";   f...