"The best way to cheer yourself up is to try to cheer somebody else up." Mark Twain

Thursday, January 7, 2010

Print Word in a triangular structure

/*   Input : World


Output :
W
Wo
Wor
Worl
World                        */



#include<iostream.h>
#include<conio.h>
#include<string.h>



void main()
{
char wrd[15];
cout<<"\n Enter a String :";
cin.getline(wrd,15);
for(int i=0; wrd[i] != '\0' ; ++i)
{  for(int j=0; j<=i; ++j)
    cout<
cout<<"\n";
}
}

No comments:

Post a Comment

C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.
Now Playing: Ballade Pour Adeline

About Me

My photo
I m an IT lecturer of a college. I love social-work. I want to do something beneficial for society before dying , that can promote our society, to some extent.