In this program, you'll learn to print pyramid of string given by user.
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char s[20];
int i, j;
cout<<"Enter the string: ";
gets(s);
for(i=0; i<strlen(s); i++)
{
for(j=0;j<=i; j++)
{
cout<< s[j];
}
cout<<"\n";
}
return 0;
}
Enter the string: Tavera
T
Ta
Tav
Tave
Taver
Tavera