#include<iostream>
using namespace std;
void changearr(int [],int);
int main()
{
int arr[30],n;
cout<<"Enter size:";
cin>>n;
cout<<"Enter the array elements:\n";
for(int i=0;i<n;++i)
{
cout<<"Enter "<<i+1<<" Element:";
cin>>arr[i];
}
cout<<"\n\n";
changearr(arr,n);
for(int j=0;j<n;++j)
{
cout<<arr[j]<<" ";
}
return 0;
}
void changearr(int n[],int a)
{
int i;
for(i=0;i<a;++i)
{
if(n[i]%2==0)
n[i]=n[i]+5;
else
n[i]=n[i]+10;
}
}
using namespace std;
void changearr(int [],int);
int main()
{
int arr[30],n;
cout<<"Enter size:";
cin>>n;
cout<<"Enter the array elements:\n";
for(int i=0;i<n;++i)
{
cout<<"Enter "<<i+1<<" Element:";
cin>>arr[i];
}
cout<<"\n\n";
changearr(arr,n);
for(int j=0;j<n;++j)
{
cout<<arr[j]<<" ";
}
return 0;
}
void changearr(int n[],int a)
{
int i;
for(i=0;i<a;++i)
{
if(n[i]%2==0)
n[i]=n[i]+5;
else
n[i]=n[i]+10;
}
}
0 comments:
Post a Comment