#include <bits/stdc++.h>
using namespace std;
void printarray(int arr[],int n)
{
cout<<"print array\n";
for(int i=0;i<n;i++)
{
cout<<arr[i]<<" ";
}
}
void revarray(int arr[],int n)
{
cout<<"\nreverse array\n";
for(int i=n;i>=0;i--)
{
cout<<arr[i]<<" ";
}
}
int main()
{
int n;
int array[]={1,6,87,9,5,7};
n=sizeof(array)/sizeof(array[0]);
printarray(array,n);
revarray(array,n-1);
return 0;
}
Post a Comment
If you have any doubts, Please let me know
Thanks!