+ 1
C++ odd/even
could someone please make a code for this?? example output: enter 5 numbers: 8 9 10 1 3 odd numbers: 9 1 3 total of odd numbers: 13 even numbers: 8 10 total of even numbers: 18 thank you!!
6 Respuestas
0
I think my brain's bleeding...
0
nearly 2am here and I can't determine the right code, need sleep. here's my code :(
#include<iostream>
using namespace std;
int main()
{
int numbers[5], sum=0;
int n;
cout<<"enter 5 numbers: "<<endl;
cin>>n;
for(int i=1;i<5;i++)
{
cin>>numbers[n];
}
if(n%2==1)
{
cout<<"odd numbers: ";
sum+=numbers[n];
}
else if(n%2==0)
{
cout<<"even numbers: ";
sum+=numbers[n];
}
return 0;
}
still won't print all the odd and even numbers
0
thanks a lot