#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, i, index;
cout << "Enter Array Size :: ";
cin >> n;
int a[n], b[2*n];
cout << "\nEnter Array Element :: ";
for(i=0; i<n; i++)
cin >> a[i];
for(i=0; i<n; i++)
{
b[i] = a[i];
b[n+i] = a[i];
}
cout << "\nEnter Index Where From Print :: ";
cin >> index;
cout << "\nArray Are :: ";
for(i=index; i<n+index; i++)
cout << b[i] << " ";
cout << "\n";
cout << "\nAnother Way Array Are :: ";
for(i=index; i<n+index; i++)
cout << a[i%n] << " ";
cout << "\n";
return 0;
}
using namespace std;
int main()
{
int n, i, index;
cout << "Enter Array Size :: ";
cin >> n;
int a[n], b[2*n];
cout << "\nEnter Array Element :: ";
for(i=0; i<n; i++)
cin >> a[i];
for(i=0; i<n; i++)
{
b[i] = a[i];
b[n+i] = a[i];
}
cout << "\nEnter Index Where From Print :: ";
cin >> index;
cout << "\nArray Are :: ";
for(i=index; i<n+index; i++)
cout << b[i] << " ";
cout << "\n";
cout << "\nAnother Way Array Are :: ";
for(i=index; i<n+index; i++)
cout << a[i%n] << " ";
cout << "\n";
return 0;
}
Comments
Post a Comment