Answer to Question #12755 in C++ for Emmanuel

Question #12755
a program that accepts 20 numbers from a user and displays all the numbers and also the even numbers included
1
Expert's answer
2012-08-10T09:55:22-0400
#include <iostream.h>

bool even(int i){
if (i%2==0) return true;
else return false;
}

int arr[20];
int i;

void main(){
for (i=0;i<20;i++){
& cout<<"enter a number: ";
& cin>>arr[i];
}
cout<<"\nHere are all entered numbers:\n";
for (i=0;i<20;i++){
& cout<<arr[i]<<" ";
}
cout<<"\n\nHere are entered even numbers:\n";
for (i=0;i<20;i++){
& if (even(arr[i])) cout<<arr[i]<<" ";
}
cout<<"\n\n";
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS