Answer to Question #217567 in C for a.s.vijay

Question #217567

Design a C program the embed special character as leading and trailing to the input string and display the output.


1
Expert's answer
2021-07-16T01:04:49-0400
#include <stdio.h>
#include <string.h>
 
int main()
{
    char strings[1000];  
    int  i,j;
 
    printf("Enter the string :");
    gets(strings);
    
	printf("Before trimming leading and trailing white spaces :'%s'",s);
	for(i=0;strings[i]==' '||strings[i]=='\t';i++);
 
	for(j=0;strings[i];i++)
	{
		strings[j++]=strings[i];
	}
	strings[j]='\0';
	for(i=0;strings[i]!='\0';i++)
	{
		if(strings[i]!=' '&& strings[i]!='\t')
				j=i;
	[j+1]='\0';
    printf("\nAfter trimming leading and trailing white spaces :'%s'",strings);
} 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS