Skip to content

Instantly share code, notes, and snippets.

@gotoark
Created December 31, 2016 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gotoark/bdb8b2be37e44e8af0e7ef3c2f5a8766 to your computer and use it in GitHub Desktop.
Save gotoark/bdb8b2be37e44e8af0e7ef3c2f5a8766 to your computer and use it in GitHub Desktop.
#include<iostream.h>
#include<conio.h>
void main(){
char n[7]="PROGRAM";
int i=0,f=1,tb,ta,sb=0,sa=5,j=0,k=6;
clrscr();
while(i<sizeof(n)){
tb=sb;
//Print white Spaces
while(tb>0){
cout<<"\t";
tb--;
}
cout<<n[j];
ta=sa;
//Print White Spaces
while(ta>=0){
cout<<"\t";
ta--;
}
if(j!=k)
cout<<n[k];
cout<<"\n";
if(j==k){
f=0;
}
if(f){
j++;
k=sizeof(n)-(j+1);
sb++;
sa=sa-2;
}else{
j--;
k=sizeof(n)-(j+1);
sb--;
sa=sa+2;
}
i++;
}
getch();
}
@gotoark
Copy link
Author

gotoark commented Dec 31, 2016

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment