#include <iostream>
char str[128], word[128];
int i, w;
int main()
{
puts("Input string: ");
gets(str);
while(str[i] != '\0') {
if (str[i] != ' ')
word[w++] = str[i];
if (((str[i] == ' ') || (str[i + 1] == '\0')) && (word[0] != '\0')) {
word[w] = '\0';
if ((word[w - 1] - '0') % 2 == 0)
puts(word);
w = 0;
word[0] = '\0';
}
i++;
return 0;
#include <iostream>
char str[128], word[128];
int i, w;
int main()
{
puts("Input string: ");
gets(str);
while(str[i] != '\0') {
if (str[i] != ' ')
word[w++] = str[i];
if (((str[i] == ' ') || (str[i + 1] == '\0')) && (word[0] != '\0')) {
word[w] = '\0';
if ((word[w - 1] - '0') % 2 == 0)
puts(word);
w = 0;
word[0] = '\0';
}
i++;
}
return 0;
}