/* Write a program that extract a sub string from a given position.
eg. “Working with string is fun” , then if from positoin 4, and 4 characters to be extracted,
that is “king”. If the number of charcters to be extracted is 0 or negative then the program should
return whole string.
*/
#include<stdio.h> main() { int i,n; char str[100]; puts("Enter the string:: "); gets(str); printf("\nEnter the position from you wanna extract string:: "); scanf("%d",&n); if(n==0 || n<0) puts(str); else for(i=n;i<n+n;i++) printf("%c",str[i]); }