#include <stdio.h>
#include <stdlib.h>
void main()
{
    char str[30],str1[30],str2[50];
    int i,n,j,k;
    printf("enter the string: ");
    fgets(str,sizeof(str),stdin);
    printf("enter the inserting string: ");
    fgets(str1,sizeof(str1),stdin);
    printf("enter the position: ");
    scanf("%d",n);
    for(i=0,k=0;i<n;i++,k++)

        str2[k]=str[i];
        for(j=0;str1[j]!='\0';j++,k++)
        str2[k]=str[j];
        for(i=n;str[i]!='\0';i++,k++)
        str[k]=str[i];
        printf("%s",str);
}

no errors for example output will be like this
enter the string:rohinnj
enter the inserting string:kumar
enter the position to be inserted:5
the inserted string is:rohinnkumarj

but i dont get correct output like this

If you don't bother to read my replies then I'm going to stop trying to help you. How do I know you aren't reading my replies? Because if you were, then you'd realise that I already answered this one with another post on a similar topic.

hey deceptikon its not like that i didnt read ur replies bcoz some times its difficult to follow ur answers(it means i didnt understand what ur replying).i dont particularly mention u .and iam bit shy to ask the questions regularly

I'm more than happy to explain anything about my posts, so please don't be afraid to ask for clarification. If you stay quiet, I'll just assume that you understood and expect you to apply that understanding in future posts.