#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char str[50], news[50];
char *s , *t ;
int pos, i , n ;
printf(" Enter a string : \n ");
gets(str);
printf(" \n Enter the position and the numbers to be extracted : ");
scanf("%d%d",&pos,&n);
s=str;
t=news;
if(n == 0)
n = strlen(str);
s = s + pos - 1 ;
for(i =0; i<n ;i++)
{
*t = *s;
s++;
t++;
}
*t = '\0';
printf(" \n \n The substring is %s \n",news);
return 0 ;
}
#include<conio.h>
#include<string.h>
int main()
{
char str[50], news[50];
char *s , *t ;
int pos, i , n ;
printf(" Enter a string : \n ");
gets(str);
printf(" \n Enter the position and the numbers to be extracted : ");
scanf("%d%d",&pos,&n);
s=str;
t=news;
if(n == 0)
n = strlen(str);
s = s + pos - 1 ;
for(i =0; i<n ;i++)
{
*t = *s;
s++;
t++;
}
*t = '\0';
printf(" \n \n The substring is %s \n",news);
return 0 ;
}
OUTPUT : -
Follow Me On Social Media :-
INSTA photography page :- https://www.instagram.com/photo_mania_hub/
Twitter link : - https://twitter.com/ApurbaKhanra199
Facebook page link (Crazy Coders) :-https://www.facebook.com/codercrazy/?modal=admin_todo_tour
Insta photography link :- https://www.instagram.com/photo_mania_hub/
Facebook link :- https://www.facebook.com/profile.php?id=100009747586288
FB photography page :- https://www.facebook.com/photomaniahub/?modal=admin_todo_tour
For tech related videos visit my other website :- https://apurbatechinfo.blogspot.com/
0 Comments