example :i am the student, user want to delete the word which size is 2 so output will be: i the student.

0 votes
asked Jan 25 by anonymous
#include<stdio.h>

#include<string.h>

void main()

{

            char a[100],x[100];

            int j, i, k,c,l;

            j = c = l = i = k = 0;

printf("Enter the string:");

            gets(a);

int b=0;

            int n = strlen(a);

            printf("n is %d\n",n);

printf("Enter the number:");

scanf("%d",&b);

aa:

       

                i=j;

                while(a[i] != ' ' && i<n)

                {

                    l=i;

                    i++;

                }
                for (k = j; k < l; i++)

                {
                   c++;
               }

                if (c != b)

                {
                    for (k = j; k < l; k++)

                    {

                        x[k] = a[j];

j++;

                    }

                    j = l + 1;

                }

                else {
                    j = l + 1;}
            goto aa;

puts(x);

}

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...