Friday, May 21, 2010

Printing Sequnce-3


/*
* Printing_Sequence.c
*
* Created on: May 21, 2010
* Author: karthikeyan.D
*
*/
#include<stdio.h>
#include<string.h>
int main()
{
int c, d,lent;
static char string[]="WelcomeTamilnadu";
lent=strlen(string);
printf("\n\n");
printf("------------------------------------\n");
for(c=0;c<=lent-1;c++)
{
d=c+1;
printf("|%*.*s|",lent,d,string);
printf("|%-*.*s|\n",lent,d,string);

}
printf("------------------------------------\n");
for(c=lent-1;c>=0;c--)
{
d=c+1;
printf("|%*.*s|",lent,d,string);
printf("|%-*.*s|\n",lent,d,string);
}
printf("------------------------------------\n");
return 0;
}

OUTPUT:

------------------------------------
| W||W |
| We||We |
| Wel||Wel |
| Welc||Welc |
| Welco||Welco |
| Welcom||Welcom |
| Welcome||Welcome |
| WelcomeT||WelcomeT |
| WelcomeTa||WelcomeTa |
| WelcomeTam||WelcomeTam |
| WelcomeTami||WelcomeTami |
| WelcomeTamil||WelcomeTamil |
| WelcomeTamiln||WelcomeTamiln |
| WelcomeTamilna||WelcomeTamilna |
| WelcomeTamilnad||WelcomeTamilnad |
|WelcomeTamilnadu||WelcomeTamilnadu|
------------------------------------
|WelcomeTamilnadu||WelcomeTamilnadu|
| WelcomeTamilnad||WelcomeTamilnad |
| WelcomeTamilna||WelcomeTamilna |
| WelcomeTamiln||WelcomeTamiln |
| WelcomeTamil||WelcomeTamil |
| WelcomeTami||WelcomeTami |
| WelcomeTam||WelcomeTam |
| WelcomeTa||WelcomeTa |
| WelcomeT||WelcomeT |
| Welcome||Welcome |
| Welcom||Welcom |
| Welco||Welco |
| Welc||Welc |
| Wel||Wel |
| We||We |
| W||W |
------------------------------------

No comments:

Post a Comment