func pattern(_ int : Int)
for i in 1...int
print(String.init(repeating:" ",count:int-i)+String.init(repeating:"1",count: 2*i - 1))
What is pattern program in swift
Pattern programs are simply patterns made up of integers, alphabets, or symbols in a specific order. The for loop condition can be used to solve these types of pattern programs quickly. There are two or more loops in each pattern program. The number of loops is determined by the pattern or logic’s complexity. The first for loop affects the row, whereas the second affects the column.