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 |
What are valid signatures for the Main function?
What is the meaning When we write "#include" what is # and what does include does there???
write a program to compare 2 numbers without using logical operators?
what is the basis for selection of arrays or pointers as data structure in a program
Write a program to print fibonacci series using recursion?
Is this program statement valid? INT = 10.50;
What is file in c language?
how to find binary of number?
What is the purpose of main() function?
what is c
write a program that prints a pascal triangle based on the user input(like how many stages) in an efficient time and optimized code?
What is an volatile variable?