Write a C program that reads a series of strings and prints
only those ending in "ed"
Answers were Sorted based on User's Feedback
Answer / mani
#include<stdio.h>
main()
{
char *a[6]={"sayed","jhsdj","manvi","buged","error"};
int i,j,k,h;
int flag=0;
for(i=0;i<5;i++)
{
j=0;
j=strlen(a[i]);
if(*(a[i]+3)=='e'&& *(a[i]+4)=='d')
{
printf("%s\n",a[i]);
}
else
{
printf("no match\n");
}
}
}
Is This Answer Correct ? | 11 Yes | 11 No |
Answer / 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 |
write a 'c' program to sum the number of integer values
a=(1,2,3); b=1,2,3; c=1,(2,3); d=(1,2),3; what's the value of 'a','b','c','d'
what is Array?
Who is the founder of c language?
what is the difference between declaration ,defenetion and initialization of a variable?
is forign key will be unique key any table or not?
Is struct oop?
What are the valid places to have keyword “break”?
i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k);
Explain what are linked list?
from which concept of 'c', the static member function of 'c++' has came?
How are strings stored in c?