+ 2

how to print 12345 in one row without using string

3rd Jan 2019, 10:56 PM
Shubham Yadav
Shubham Yadav - avatar
8 Respostas
+ 8
print(*(n for n in range(1,6)), sep="") or just print(12345) as suggested by Diego
4th Jan 2019, 1:33 AM
David Ashton
David Ashton - avatar
+ 6
Language - Python This might be cheating but try it: num = 12345; print(num) And next time please specify the programming language.
3rd Jan 2019, 11:16 PM
Diego
Diego - avatar
+ 5
Another way of getting the same result: print(chr(49)+chr(50)+chr(51)+chr(52)+chr(53))
3rd Jan 2019, 11:20 PM
Diego
Diego - avatar
+ 3
In Python: for i in range (1,6): print (i,end='') Output: 12345
13th Jan 2019, 4:55 PM
Mario Banušić
Mario Banušić - avatar
+ 2
in Java: for (int i=0; i<5; i++) { System.out.print(i+1)}
4th Jan 2019, 3:53 PM
magischer Keks
+ 2
in python 2/3 print(12345)
4th Jan 2019, 7:14 PM
DeliriousGod
+ 1
language - JavaScript console.log( Number( [...Array(5)].map((n, i) => i + 1).join('') ))
4th Jan 2019, 3:06 PM
Martin Skope
Martin Skope - avatar
+ 1
Language: python Hey,try this: print(pow(1111,2)//pow(10,3))
5th Jan 2019, 11:45 AM
shreyash joshi
shreyash joshi - avatar