Student Portfolio >> Index >> Coding >> Exercise 6
#include <iostream.h>
int findave(float, float, float);
int main()
{ int ave=0;
float one, two, three;
cout << "Enter First Value: ";
cin >> one;
cout <<"Enter Second Value: ";
cin >> two;
cout <<"Enter Third Value: ";
cin >> three;
ave=findave(one,two,three);
cout << "The Average of "<<one<<", "<<two<<" & "<<three<< " is "<< ave<<endl;
return 0;
}
int findave(float one, float two, float three)
{ float average, averagetot;
averagetot = one + two + three;
average = averagetot / 3;
return average;
}
<< Back Forward >> |
Copyright 2005 Kerstin Kegel