c programing Write a program that needs 5 words and prints o
c programing
Solution
#include <stdio.h>
#include<string.h>
int main()
{
char s[50][80], last = \' \', temp[80];
int line = 0, i;
printf(\"Number of values you want to enter\ \");
scanf(\"%d\",&line);
printf(\"enter %d values\ \",line);
for(i=0;i<line;i++)
{
scanf(\"%s\", s[i]);
}
printf(\"\ Words that end with the letter d:\ \");
for(i=0;i<line;i++)
{
strcpy(temp, s[i]);
last = temp[strlen(s[i]) - 1];
if(last == \'d\')
printf(\"%s\ \", s[i]);
}
return 0;
}
