Created
December 30, 2016 06:36
-
-
Save gotoark/72d13d629c83847d6bd78ad1a4a4b5d0 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<<" "; | |
tb--; | |
} | |
cout<<n[j]; | |
ta=sa; | |
//Print White Spaces | |
while(ta>0){ | |
cout<<" "; | |
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