03240509_3625

03240509_3625 - 1 . 5 ) . Even ) ( Odd ( . #include

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 . 5 ) . Even ) ( Odd ( . #include <iostream.h> read(int ar) { cout<<"Enter 5 numbers:"; for(int i=0; i<=4; i++) cin>>ar[i]; } isEven(int x) { if(x % 2 == 0) return 1; return 0; } isOdd(int x) { return (!isEven(x)); } printEven(int ar) { cout<<"Even numbers: "; for(int i=0; i<=4; i++) if(isEven(ar[i])) cout<<ar[i]<<" "; cout<<endl; } printOdd(int ar) { cout<<"Odd numbers: "; for(int i=0; i<=4; i++) if(isOdd(ar[i])) cout<<ar[i]<<" "; cout<<endl; } main() { int a[5]; read(a); printEven(a); printOdd(a); int b[5]; read(b); printEven(b); printOdd(b); } 1 2 . 5 ) . Positive ( ) Negative . ( #include <iostream.h> read(int ar) { cout<<"Enter 5 numbers:"; for(int i=0; i<=4; i++) cin>>ar[i]; } isPositive(int x) { if(x >= 0) return 1; return 0; } isNegative(int x) { return (!isPositive(x)); } printPositive(int ar) { cout<<"Positive numbers: "; for(int i=0; i<=4; i++) if(isPositive(ar[i])) cout<<ar[i]<<" "; cout<<endl; } printNegative(int ar) { cout<<"Negative numbers: "; for(int i=0; i<=4; i++) if(isNegative(ar[i])) cout<<ar[i]<<" "; cout<<endl; } main() { int a[5]; read(a); printPositive(a); printNegative(a); int b[5]; read(b); printPositive(b); printNegative(b); } 2 3 ....
View Full Document

Page1 / 10

03240509_3625 - 1 . 5 ) . Even ) ( Odd ( . #include

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online