#include<iostream>
#include<array>
using namespace std;
#define N 5
void InputArray(){
int arr[10];
cout<<"Enter the elements of the array\n";
for(int i=0; i<10; i++){
cout<<"Enter element\t"<<(i+1);
cin>>arr[i];
}
}
void OutputArray(){
int arr[10];
cout<<"The array elements are\n";
for(int i=0; i<10; i++){
cout<<arr[i]<<"\n";
}
}
int Minx(int arr[3]){
int min = arr[0];
for(int i=0; i<3; i++){
if(min > arr[i]){
min = arr[i];
}
}
return min;
}
int Avx(int arr[N]){
float sum = 0.0;
for(int i=0; i<N; i++){
sum +=arr[i];
}
return sum/N;
}
int CountAv(int arr[6]){
int count = 0;
int average = Avx(arr);
for(int i=0; i<6; i++){
if((average == arr[i] - 1) ||( average == arr[i] + 1 || average==arr[i])){
count += 1;
}
}
return count;
}
int main(){
int arr1[6]={3,2, 4, 5, 1, 3};
cout<<CountAv(arr1)<<"\n";
int arr[3] = {8,9,2};
cout<<Minx(arr);
return 0;
}
Comments
Leave a comment