Python program to print the number from to 100 in intervals of 10 in vertical

Program to print the number from to 100 in intervals of 10 in vertical

1 11 21 31 41 51 61 71 81 91
2 12 22 32 42 52 62 72 82 92
3 13 23 33 43 53 63 73 83 93
4 14 24 34 44 54 64 74 84 94
5 15 25 35 45 55 65 75 85 95
6 16 26 36 46 56 66 76 86 96
7 17 27 37 47 57 67 77 87 97
8 18 28 38 48 58 68 78 88 98
9 19 29 39 49 59 69 79 89 99
10 20 30 40 50 60 70 80 90 100

We want to print the number like this

How this code work

  1. First we take the input from the user.
  2. Then we iterate the for loop from 1 to 10+1, because it is the number of the rows.
  3. Then we iterate the nested loop from i,n+1 then 10 difference, because in horitontal we want to print the number with difference 10.
        eg: 1 11 21 31 41 51 61 71 81 91  

#n = int(input("Enter"))
n= 100

for i in range(1,11):
    for j in range(i,n+1,10):
        print(j,end=" "
    print() 
Next Post Previous Post
1 Comments
  • High Technologies Solutions
    High Technologies Solutions February 10, 2021 at 1:55 PM

    Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective.

    Python Training Institute in South Delhi

Add Comment
comment url