Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
661 B
2
Indexable
Never
#include <stdio.h>
#include <math.h>
#define SIZE 5 
void enter(int a[SIZE]){
 	for(int i = 0; i < SIZE; i++){
	printf("enter a[%d]: ", i+1);
	scanf("%d", &a[i]);
	if(a[i] == 0)
	break;
}
  }
int tongnam(int a[SIZE]) {
	int sum = 0, den = 0;
	for(int i = 0; i < SIZE; i++){
		abs(a[i]);
		if(a[i] % 5 == 0){
			den++;
		sum += a[i];
		}
	}
	return sum / den;
}
int soamchan(int a[SIZE]){
	int dem = 0;
	for(int i = 0;i < SIZE; i++){
		if(a[i] < 0 && a[i] % 2 ==0 )
		dem++;
	}
	return dem;
}
int main() {
int a[SIZE];
enter(a);
printf("\nave number = %d",tongnam(a ));
printf("\nco %d so am chan", soamchan(a));

return 0;
}