Give program for this output
abcdeedcba
abcdxxdcba
abcxxxxcba
abxxxxxxba
axxxxxxxxa

Recommended Answers

All 4 Replies

#include <stdio.h>

int main()
{
printf("abcdeedcba\nabcdxxdcba\nabcxxxxcba\nabxxxxxxba\naxxxxxxxxa\n");

return 0;
}

thank u!
but i need this output using for loop

const char const * strings[] = {"abcdeedcba\n","abcdxxdcba\n","abcxxxxcba\n","abxxxxxxba\n","axxxxxxxxa\n",
     NULL};
for(char const ** ptr = strings; *ptr; ++ptr)
{
	printf(*ptr);
}

I'd start with plgriffith's program and make a minor change

#include <stdio.h>

int main()
{
    char buf[] = "abcdeedcba\nabcdxxdcba\nabcxxxxcba\nabxxxxxxba\naxxxxxxxxa\n";
    int  i;

    i = 0;
    while (buf[i])
    {
        putchar (buf[i++]);
    }
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.