#include <iostream>using std::cout;using std::endl;int main(){ int a[15] = { 2, 5, 4, 6, 8, 9, 3, 6, 1, 0, 0, 5, 6, 9, 8 }; int sum = 0; for(int i = 0; i < 15; i++) { if(a[i] % 4 == 0) { sum += a[i]; } cout << a[i] << ' '; } cout << "\nSum = " << sum << endl; return 0;}
#include <iostream>
using std::cout;
using std::endl;
int main()
{
int a[15] = { 2, 5, 4, 6, 8, 9, 3, 6, 1, 0, 0, 5, 6, 9, 8 };
int sum = 0;
for(int i = 0; i < 15; i++)
{
if(a[i] % 4 == 0)
{
sum += a[i];
}
cout << a[i] << ' ';
}
cout << "\nSum = " << sum << endl;
return 0;
}