Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- using namespace std;
- int main()
- {
- int niza[100],nizaP[100],nizaN[100],i,n,brElemP=0,brElemN=0;
- cout<<"Vnesi broj na elementi vo nizata"<<endl;
- cin>>n;
- for(i=0;i<n;i++)
- {
- cin>>niza[i];
- }
- int j=0;
- int k=0;
- for(i=0;i<n;i++)
- {
- if(niza[i]%2==0)
- {
- nizaP[j]=niza[i];
- j++;
- brElemP++;
- }
- else
- {
- nizaN[k]=niza[i];
- k++;
- brElemN++;
- }
- }
- for(j=0;j<brElemP;j++)
- {
- cout<<nizaP[j]<<",";
- }
- cout<<endl;
- for(k=0;k<brElemN;k++)
- {
- cout<<nizaN[k]<<",";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment