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 comment