#include <iostream>
using namespace std;
// Ham tinh tong cac so chan
int tongChan(int arr[], int n)
{
int t /> for (int i = 0; i < n; i++)
{
if (arr[i] % 2 == 0)
{
tong += arr[i];
}
}
return tong;
}
// Ham tinh tong cac so le
int tongLe(int arr[], int n)
{
int t /> for (int i = 0; i < n; i++)
{
if (arr[i] % 2 != 0)
{
tong += arr[i];
}
}
return tong;
}
// Ham tinh tong cac so am
int tongAm(int arr[], int n)
{
int t /> for (int i = 0; i < n; i++)
{
if (arr[i] < 0)
{
tong += arr[i];
}
}
return tong;
}
// Ham tinh tong cac so duong
int tongDuong(int arr[], int n)
{
int t /> for (int i = 0; i < n; i++)
{
if (arr[i] > 0)
{
tong += arr[i];
}
}
return tong;
}
int main()
{
int n, arr[100];
cout << "Nhap so phan tu cua mang: ";
cin >> n;
cout << "Nhap cac phan tu cua mang:\n";
for (int i = 0; i < n; i++)
{
cout << "arr[" << i << "] = ";
cin >> arr[i];
}
// Tinh tong cac loai so
int t n);
int t n);
int t n);
int t n);
// Xuat ket qua
cout << "Tong cac so chan: " << tongChan << endl;
cout << "Tong cac so le: " << tongLe << endl;
cout << "Tong cac so am: " << tongAm << endl;
cout << "Tong cac so duong: " << tongDuong << endl;
return 0;
}