For more exercises,
visit shegertech.blogspot.com
or
shegertech.com
Author: Eyasu M.
Email: eyasu@india.com
*/
#include <iostream>
using namespace std;
int count;
double sum;
void squareRootChecker(int x[], int size){
bool flag = false;
for(int y=0;y<size;y++){
for(int i=1;i<x[y];i++){
if(i*i == x[y] && x[y]%2!=0){
sum+=x[y];
count++;
}
}
}
}
int getCount(){
return count;
}
double getSum(){
return sum;
}
double getAverage(){
double average = getSum()/getCount();
return average;
}
int main(){
int x[15]={1,5,4,6,9,11,16,19,25,35,36,39,42,49,50};
squareRootChecker(x, 15);
cout<<"The average of the odd perfect squares from the array values is "<<getAverage()<<endl;
return 0;
}
// subscribe to our email list so that we notify you when new things happen.