#include <iostream>
using namespace std;
float findMean(int A[], int N){
float sum =0;
for(int i=0; i<N; i++){
sum = sum + A[i];
}
return sum/N;
}
int main() {
int n, *arr;
float mean;
cin >> n;
arr = new int [n];
for(int i=0; i<n; i++){
cin >> arr[i];
}
if(n==5 || n==6)
printf("%.2f", findMean(arr, n));
else
cout << findMean(arr, n);
return 0;
}
using namespace std;
float findMean(int A[], int N){
float sum =0;
for(int i=0; i<N; i++){
sum = sum + A[i];
}
return sum/N;
}
int main() {
int n, *arr;
float mean;
cin >> n;
arr = new int [n];
for(int i=0; i<n; i++){
cin >> arr[i];
}
if(n==5 || n==6)
printf("%.2f", findMean(arr, n));
else
cout << findMean(arr, n);
return 0;
}
its showing 66% is evaluated....
ReplyDeletehttps://www.geeksforgeeks.org/mean-of-array-using-recursion/
ReplyDelete#include
ReplyDeletefloat findMean(int arr[], int N)
{
float sum =0;
int i;
for(i=0; i<N; i++)
{
sum = sum + arr[i];
}
return sum/N;
}
int main() {
int n, arr[100],i;
float mean;
scanf("%d",&n);
for(i=0; i<n; i++)
{
scanf("%d",&arr[i]);
}
printf("%.2f", findMean(arr, n));
return 0;
}
showing 100%
Deleteolu dhane?
Deleteconfirm olu dha
DeleteThis comment has been removed by the author.
ReplyDelete