Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main(){
- int array[5];
- cout << "\t Tentukan Ganjil / Genap \n\n";
- for(int i = 0; i < 5; i++){
- cout << " Nilai ke-" << i + 1 << " = ";
- cin >> array[i];
- }
- cout << endl;
- cout << " Bilangan Genap = ";
- for(int i = 0; i < 5; i++){
- if(array[i] % 2 == 0){
- cout << array[i] << " ";
- }
- }
- cout << endl;
- cout << " Bilangan Ganji = ";
- for(int j = 0; j < 5; j++){
- if(array[j] % 2 != 0){
- cout << array[j] << " ";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement