here 5 is occurring at index 1 and index 1 is occurring as element at index 3
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a[n+1],h[51];
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
h[a[i]]=i;
}
for(int i=1;i<=n;i++)
printf("%d\n",h[h[i]]);
}
No comments:
Post a Comment