Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //g++ 7.4.0
- #include <iostream>
- using namespace std;
- int main()
- {
- int array[10] = {1,5,6,8,7,4,9,10,22,13};
- for(int i = 5; i < 10; i++) {
- if(array[i] %2 == 0) {
- for( int j = 0; j < 5 ; j++ ) {
- if( array[j] % 2 != 0) {
- int temp = array[i];
- array[i] = array[j];
- array[j] = temp;
- }
- }
- }
- }
- for(int i = 0; i<10; i++){
- cout << array[i] << ' ';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement