Wednesday, 11 February 2015

printing triangle pattern


       

word="ayman"
a="*"
c="h"
d="i"
n=0
m=0
while n<10:
    n=n+1
    print(c,end='')
    print(d,end='')
    print(a,end='')
    for b in word:
     print(b,end='')       
    print(a)
    m=0
    print(c,end='')
    while m<=n:
        print(d,end='')
        m=m+1
        
while n>=0:
      n=n-1
      print(a,end='')
      for b in word:
          print(b,end='')
      print(a)
      m=0
      print(c,end='')
      while m<n:
           m=m+1
           print(d,end='')
      print(d,end='')  
        
    

No comments:

Post a Comment