Created
December 31, 2016 07:36
-
-
Save gotoark/bdb8b2be37e44e8af0e7ef3c2f5a8766 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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(); | |
} |
Author
gotoark
commented
Dec 31, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment