+ 2
I need solution for this pattern only use only one loop like only one for loop or only one while loop
1 10 101 0101
6 odpowiedzi
+ 3
if the pattern is
1
10
101
0101
10101
101010
1010101
01010101
101010101
(since no language given it will be Python because it's short):
s = "1"
m = 10
for i in range(m):
if i % 4 == 0:
s = s + "0"
elif i % 4 == 1:
s = s + "1"
elif i % 4 == 2:
s = "0" + s
else:
s = "1" + s
print(s)
(if it's a diffrent pattern, write more of it and write which language you actually need ...)
+ 2
Thank you sir
+ 2
Anton Böhler People need to learn how to ask questions properly :p
0
Tibor Santa well it's not wrong 😂😂😂
0
How to print using for loop in python
1010101
10101
101
1