Write a C program that reads a series of strings and prints
only those ending in "ed"

Answer Posted / antony from chennai

void main()
{
char *s[10];
int n;
printf("No of strings:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%s",s[i]);
}
for(i=1;i<=n;i++)
{
int len;
len=strlen(*s[i]);
len=len-1;
if(*s[len]='e' && *s[len--]='d')
{
printf("%s",*s[i]);
}
else
{
printf("no match");
}
}
getch();
}
}

Is This Answer Correct ?    4 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is cohesion and coupling in c?

582


What is meant by realloc()?

666


Can you think of a logic behind the game minesweeper.

1999


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

651


how to write optimum code to divide a 50 digit number with a 25 digit number??

2743






What is difference between union All statement and Union?

621


What is volatile variable how do you declare it?

558


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2401


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

621


How do you generate random numbers in C?

643


Subtract Two Number Without Using Subtraction Operator

346


What is hashing in c language?

603


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

3132


what do you mean by enumeration constant?

588


How can I manipulate individual bits?

597