Thanks for the answer
This is the program, how do you think, it's ok?
Code:
#include <stdio.h>
#include <stdlib.h>
float media (float s, int n);
float media2 (float s2, int n);
main () {
int n=5, i, v[n], v2[n], st;
float s=0, s2=0;
for(i=0; i<n; i++) {
printf("Enter numbers first vector ");
scanf("%d",&v[i]);
}
for(i=0; i<n; i++) {
printf("Enter numbers second vector ");
scanf("%d",&v2[i]);
}
for(i=0; i<n; i++) {
s=s+v[i];
}
for(i=0; i<n; i++) {
s2=s2+v2[i];
}
st=s+s2;
printf("the sum of two vectors is %d\n",st);
media(s,n);
media2(s2,n);
if(media>media2) {
printf("The average of the first carrier is greater than the average of the second vector\n");
}
else {
printf("The average of the second carrier is greater than the average of the first vector\n");
}
system("pause");
}
float media (float s, int n) {
float media;
media=s/5;
printf("The average of first vector is %.2f\n",media);
return media;
}
float media2 (float s2, int n) {
float media2;
media2=s2/5;
printf("The average of second vector is %.2f\n",media2);
return media2;
}