6/*Write a ‘C’ program to accept a string from user and generate following pattern (e.g. input string “abcd”)*/ a a b a b c a b c d a b c a b a


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char s[30];
int i;
clrscr();
puts(“\n Enter a string:”);
gets(s);
for(i=0;i<=strlen(s);i++)
{
printf(“%-80.*s”,i,s);
}
for(i=strlen(s)-1;i>=1;i–)
{
printf(“%-80.*s”,i,s);
}
getch();
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s