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 |
How can I do graphics in c?
1. Write a C program to count the number of occurrence of a specific word in the given strings. (for e.g. Find how many times the word “live” comes in the sentence “Dream as if you’ll live forever, live as if you’ll die today ”)
Differentiate between new and malloc(), delete and free() ?
#‎include‬<stdio.h> void main() { int i; for(i=5;0;i++) { printf("%d",i); } }
What is null pointer constant?
why TCS selected more student in the software field from all institution.
Why double pointer is used in c?
What is hashing in c language?
what is the difference between while and do while?
n=7623 { temp=n/10; result=temp*10+ result; n=n/10 }
What is hungarian notation? Is it worthwhile?
Explain low-order bytes.