Is there any mistake?
I want this program to shift numbers cyclically one right position.
#include <iostream>
using namespace std;
int main()
{
int i,h;
cin>>h;
double a[h];
for(i=0;i<h;i++)
{
cin>>a[i];
}
for(i=(h-1);i<h;i++)
{
cout<<a[i]<<" ";
}
for(i=0;i<(h-2);i++)
{
cout<<a[i]<<" ";
}
for(i=(h-2);i<(h-1);i++)
{
cout<<a[i];
}
return 0;
}
Last edited on