Showing posts with label Sequence Equation Hacker Rank Solution in C. Show all posts
Showing posts with label Sequence Equation Hacker Rank Solution in C. Show all posts

Thursday, 27 August 2020

Sequence Equation Hacker Rank Solution in C

 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]]);
}