#include<iostream>
using namespace std;
int main()
{
const int num = 5;
int i, a[num], x;
cout << "请为数组元素赋值(5个整数):";
for (i = 0; i < num; i++)
{
cin >> a[i];
}
for (x = 0; x < num; x++)
{
if ((a[x] % 5) ==0)
a[x] = 0;
}
cout << "替换后的元素分别为:";
for (i = 0; i<num; i++)
cout << a[i] << "\t";
system ("pause");
return 0;
}
Last modification:December 5th, 2018 at 07:20 pm
© 允许规范转载