+ 1
How to find Average elements of integers in c program
3 odpowiedzi
0
public int Average(int[] elements){
int sum = 0;
for(int i=0; i < elements.length; i++){
sum += elements[i];
}
return sum/elements.length;
}
0
int b=0, n=0; cin>>n; float *a=new float [n]; for(int m=0;m<n;++m) cin>>a[m]; for(int i=0;i<n;++i) for(int j=i+1;j<n;++j) for(int k=0;k<n;++k) if ((a[i]+a[j])/2==a[k]) ++b; cout<<b; return 0; will you convert it into c
0
Here's a solution:
https://code.sololearn.com/cPY5aQ1KLqwk/?ref=app
Good code has good layout, and comments!