Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to get substring of entered text or word by taking starting index and number of characters from a user

Posted By: Chika Suzuki     Category: C Programming     Views: 3558

Program to get substring of entered text or word by taking starting index and number of characters from a user

Code for Program to get substring of entered text or word by taking starting index and number of characters from a user in C Programming

#include <stdio.h>
#include <conio.h>

    void main()
    {
        char a[30];
        int i,n,n1;
        clrscr();
        printf("\n enter the String : ");
        scanf("%[^\n]",a);
        printf("\n extract start: ");
        scanf("%d",&n);
        printf("\n extract how many : ");
        scanf("%d",&n1);
        printf("\n extarct charecter are : ");
        for(i=n-1;i<n1+n-1;i++)
        {
            printf("%c",a[i]);
        }
        getch();
    }
/*
******
OUTPUT
******

enter the String : CPROGRAMMING

extract start: 3

extract how many : 4

extarct charecter are : ROGR
*/
  
Share: 



Chika Suzuki
Chika Suzuki author of Program to get substring of entered text or word by taking starting index and number of characters from a user is from Tokyo, Japan.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!