Anda di halaman 1dari 1

#include<iostream.

h>
#include<conio.h>
void modify_arr(int ar[],int N)
{ for (int j=0;j<N;j++)
{ if (ar[j]%2==0)
ar[j]/=2;
else
ar[j]*=2; }
for (int k=0;k<N;k++)
{
cout<<"the new ar["<<k<<"] is:"<<ar[k]<<endl;
}
}
void main()
{ clrscr();
int ar[10],n;
cout<<"enter the elements(max.10)";
cin>>n ;
for (int i=0;i<n;i++)
{
cout<<"the ar["<<i<<"] is:";
cin>>ar[i];
}
modify_arr(ar,n);
getch();
}

Anda mungkin juga menyukai