11 while loop nest

# (1) Print ten ten rows of small stars (two cycles) 
 
 
Print ( "<==>") 
J = 0 
the while J <10: 
 
    # ten small stars print a line 
    I = 0 
    the while I <10: 
        Print ( "*", End = "") 
        i + =. 1 
 
    # control line feed 
    Print () 
    j + =. 1 
 
# print ten rows ten every other column color change little stars 
' '' outer row j action once inside the column i movable 10 , the outer layer to move more slowly, in the movable block layer '' ' 
Print ( "<==>") 
J = 0 
the while J <10: 
 
    # ten small stars print a line 
    I = 0 
    the while I <10: 
        # Print control stars 
        IF I% 2 == 0: 
            # print control scab 
            Print ( "★", End = "") 
        the else:
            White Star # controls the printing 
            Print ( "☆", End = "") 
        I + =. 1
  
    # switching control line
    Print () 
    J =. 1 + 
 
 
# ten ten rows interlaced printing color change Little Star 
Print ( "<==>") 
J = 0 
the while J <10: 
 
    # ten small stars print a line 
    I = 0 
    the while I <10: 
        # controlling the printing stars 
        IF J% 2 == 0: 
            # controls the printing scab 
            Print ( "★", End = "") 
        the else: 
            # controls the printing white Star 
            Print ( "☆", End = "") 
        I + =. 1 
 
    # control wrap 
    Print () 
    J + =. 1 
     
     
# 99 multiplication table 
# direction of a 
I =. 1 
the while I <=. 9: 
 
    # output 99 multiplication table 
    J =. 1 
    the while J <= I: 
        Print ( "% D *% D =% 2D"% (i, j, i * j ), end = "") 
        J =. 1 + 
     
    # perform a line feed
    Print ()
     
    i+=1
# Two directions 
Print ( "<==>") 
I =. 9 
the while I> =. 1: 
 
 
    # 99 outputs multiplication table 
    J =. 1 
    the while J <= I: 
        Print ( "% D * = D%% 2D"% (I , J, I * J), End = "") 
        J =. 1 + 
     
    # performs a line 
    Print () 
 
 
    I-. 1 = 
 
# 100 ~ 999 to find a lucky number 222 123 321 888 ... 111 
 
"" " 
n-= 567 
n-// = 100>. 5 
n-10 // 10% =>. 6 
n-10% =>. 7 
"" " 
Print (10 567%) 
# method of 
I = 100 
the while I <= 999:
    # One hundred 
    Baiwei I = 100 // 
    # ten 
    Shiwei I = 10 // 10% 
    # bits 
    gewei = 10% I 
     
    IF Shiwei Shiwei == == gewei and Baiwei:
        Print (I) 
     
    # 123 456 
    IF Shiwei gewei == - == Baiwei + 1'd. 1 and Shiwei: 
        Print (I) 
     
    # 654 987 
    IF +. 1 and gewei Shiwei Shiwei == == -1 Baiwei: 
        Print (I) 
     
     
    I + = 1 
 
 
 
# ### one hundred money one hundred dollar chicken rooster hen chicks three dollars a 5 cents to buy a 100 yuan to buy 100 chickens how many law (classical questions) 
"" " 
exhaustive: a test a 
a => (1,2) 
B => (3,4-) 
C => (5,6) 
a + B + C == 10? 
 
. 1. 5. 3 
. 1. 6. 3 
. 1. 4. 5 
. 1 . 6. 4 
2. 5. 3 
2. 6. 3 
2. 5. 4 
2. 4. 6 
X, Y, Z 
X + Y + Z == * 100. 3 and X + Y + Z = 0.5 * 100  
"" " 
# z X rooster chicks hen y 
x = 0
the while X <= 100: 
 
    Y = 0 
    the while Y <= 33 is: 
     
        Z 0 =
        while z<= 100:
         
            if (x+y+z == 100) and (x+y*3+0.5*z == 100):
                print(x,y,z)
            z+=1
     
        y+=1
 
    x+=1

  

Guess you like

Origin www.cnblogs.com/eliwen/p/10968465.html