#include <iostream>
using namespace std;
int main()
{
int n, a, b, i, count = 0, secondcount = 0, d, e;
cout << "enter the number of terms you want to check" << endl;
cin >> n;
int arr[n];
cout << "enter the numbers" << endl;
for (i = 0; i < n; i++)
{
cin >> arr[i];
}
cout << "the numbers you entered are" << endl;
for (i = 0; i < n; i++)
{
cout << arr[i] << endl;
}
for (i = 0; i < n; i++)
{
if (arr[i] % 2 == 0)
{
count++;
}
else if (arr[i] % 2 != 0)
{
secondcount++;
}
}
if (arr[i] % 2 == 0)
{
cout << "number of even terms in the list you entered is " << count << endl
<< "number of odd terms in the list you entered is " << secondcount << endl;
}
return 0;
}
No comments:
Post a Comment