#include<stdio.h>
#include<conio.h>
#include<string.h>
void main( )
{
char str [60];
int i,l1,posi,n;
clrscr( );
printf("Enter a string ");
gets(str);
l1=strlen(str);
printf("Enter the position of substring :");
scanf("%d",&posi);
printf("Enter no. of character to be extracted :");
scanf("%d",&n);
if (posi+n-1>11)
printf("substring is ");
else
{
printf("substring is ");
for(i=posi-1;i<posi+n-1;i++)
printf("%c",str[i]);
}
getch( );
}