|
Post by Josh on Jun 5, 2017 20:20:25 GMT
CountingIn this programming exercise, you must output every integer from 1 - 49 as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 You must not hardcode your solution. Feel free to golf your solution. If you do so, please provide the amount of characters in your code.
Make sure that you provide the name of the language you completed wrote the solution in.
Good luck!
|
|
Hex
New Member
Posts: 19
|
Post by Hex on Jun 6, 2017 7:19:02 GMT
a=""for i=1,49 do a=a.." "..i end print(a:sub(2))
Lua 42 characters
|
|
omgitspenguins
Active Member
Veteran
OmgStillAPenguin
Posts: 53
ROBLOX Username: penguins113311
|
Post by omgitspenguins on Jun 6, 2017 8:58:03 GMT
for i in range(50): if i!=0:print(i)
Python3 38 Characters
|
|
|
Post by dance1211 on Jun 6, 2017 9:01:41 GMT
1:49
MATLAB 4 Characters
|
|
|
Post by 128Gigabytes on Jun 6, 2017 9:02:09 GMT
Lua, 34 x=0;while(x<49)do x=x+1print(x)end
|
|
omgitspenguins
Active Member
Veteran
OmgStillAPenguin
Posts: 53
ROBLOX Username: penguins113311
|
Post by omgitspenguins on Jun 6, 2017 9:04:29 GMT
Nvm
|
|
alu
New Member
Posts: 3
|
Post by alu on Jun 9, 2017 22:48:40 GMT
HolyC
I64 i; for (i = 0; i < 50; i++) "%d\n", i;
|
|
john
New Member
Posts: 11
|
Post by john on Jun 10, 2017 15:43:42 GMT
~@i=1,49I.w(i)I.w' '$ golflua, 21 bytes.
|
|
|
Post by kridnol on Jun 19, 2017 21:13:30 GMT
assuming it needed to be printed exactly as shown: JavaScript, 32 chars
for(a='',b=1;b<50;a=a+b+++' ');a
or if it can be printed in any way: JavaScript, 31 chars
for(a=1;a<50;console.log(a++));
|
|
|
Post by AxonMega on Jun 27, 2017 11:25:42 GMT
puts *(1..49) Ruby, 13 characters. Have I won?
|
|