#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <time.h>
void A(int* a)
{
for (int i = 0; i < 10; i++)
{
a[i] = 10 + rand() % 90;
s += a[i];
}
}
void printS()
{
printf("Среднее арифметическое: %d, s/10);
}
int main()
{
setlocale(0, "");
srand(time(NULL));
int a[10], i;
int s = 0;
int* ax = a;
A(ax);
PrintS();
return 0;
}
#include <iostream>
#include <string>
#include <stdio.h>
double get_average_massive(int32_t* m_array, uint8_t m_size_array)
{
double sum = 0.0;
for (int32_t i = 0; i < m_size_array; i++)
{
m_array[i] = i;
sum += m_array[i];
}
double m_average = sum/(double)m_size_array;
return m_average;
}
void print_average_value(double *ptr_average)
{
printf(" Average value = %lf", *ptr_average);
}
int main()
{
const uint8_t size_Array_A = 10;
int32_t Array_A[size_Array_A];
double average = get_average_massive(Array_A, size_Array_A);
print_average_value(&average);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <time.h>
void A(int* a, double* s)
{
for (int i = 0; i < 10; i++)
{
a[i] = i;
*s += a[i];
}
}
void printS(double s)
{
printf("Среднее арифметическое: %lf", s/10);
}
int main()
{
setlocale(0, "");
srand(time(NULL));
int a[10];
double s = 0;
int* ax = a;
A(ax, &s);
printS(s);
return 0;
}