500 ways to print [1..10]!

Reply

Join Date: Oct 2006
Posts: 16
Reputation: Zonr_0 is an unknown quantity at this point 
Solved Threads: 3
Zonr_0 Zonr_0 is offline Offline
Newbie Poster

Re: 500 ways to print [1..10]!

 
0
  #61
Oct 27th, 2006
Python
[php]
def counting(i=0):
while i < 11:
print i,
i += 1

counting()
[/php]
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,616
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 466
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: 500 ways to print [1..10]!

 
0
  #62
Oct 30th, 2006
First LUA version:

for i = 1,10 do print(i) end
Last edited by ~s.o.s~; Oct 30th, 2006 at 2:09 pm.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 521
Reputation: pty is on a distinguished road 
Solved Threads: 37
pty's Avatar
pty pty is offline Offline
Posting Pro

Re: 500 ways to print [1..10]!

 
0
  #63
Oct 31st, 2006
Originally Posted by Zonr_0 View Post
Python
[php]
def counting(i=0):
while i < 11:
print i,
i += 1

counting()
[/php]
slightly shorter way in python

print range(1,11)
Note to self... pocket cup
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 223
Reputation: Anonymusius is on a distinguished road 
Solved Threads: 10
Anonymusius's Avatar
Anonymusius Anonymusius is offline Offline
Posting Whiz in Training

Re: 500 ways to print [1..10]!

 
0
  #64
Oct 31st, 2006
Casio:
for 0[save]a to 10 step 1[enter]
a[print]
next[enter]
I don't know how to put some char's
Last edited by Anonymusius; Oct 31st, 2006 at 1:05 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 223
Reputation: Anonymusius is on a distinguished road 
Solved Threads: 10
Anonymusius's Avatar
Anonymusius Anonymusius is offline Offline
Posting Whiz in Training

Re: 500 ways to print [1..10]!

 
0
  #65
Oct 31st, 2006
You said to count the number of ways by post count, so that's why I do this one in an new post.

Basic:
10 L = 1
20 PRINT L
30 L = L + 1
40 IF L <= 10 then 20
50 END
I did some basic on my commodore, but my parent's get pissed off every time I take it down to the television, so...
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 4
Reputation: AnonCSAddict is an unknown quantity at this point 
Solved Threads: 0
AnonCSAddict AnonCSAddict is offline Offline
Newbie Poster

Re: 500 ways to print [1..10]!

 
0
  #66
Nov 6th, 2006
I definitely will have the shortest
Matlab
1:10
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 486
Reputation: Bench has a spectacular aura about Bench has a spectacular aura about Bench has a spectacular aura about 
Solved Threads: 48
Bench's Avatar
Bench Bench is offline Offline
Posting Pro in Training

Re: 500 ways to print [1..10]!

 
0
  #67
Nov 6th, 2006
how about a competition for most obfuscated
C++
#include <iostream>

int main()
{
    int _0(0);
    while("\"#$%&\'()*+,"[_0]!=',')
        std::cout<<static_cast<int>("\"#$%&\'()*+"[_0++]-'!')<<" ";
}
Last edited by Bench; Nov 6th, 2006 at 3:01 pm. Reason: Grr! The [CODE=CPP] tag filters out escape sequences!
¿umop apisdn upside down?
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 13
Reputation: webspy is an unknown quantity at this point 
Solved Threads: 0
webspy's Avatar
webspy webspy is offline Offline
Newbie Poster

Re: 500 ways to print [1..10]!

 
0
  #68
Nov 14th, 2006
C++

#include <iostream>

int main()
{
    for(int i = 1; i <= 10; std::cout << i++);
    return 0;
}

#include <iostream>

int main()
{
    int i = 1;
    while(i <= 10 ? std::cout << i++: false);
    return 0;
}
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,847
Reputation: niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute 
Solved Threads: 298
Moderator
Featured Poster
niek_e's Avatar
niek_e niek_e is offline Offline
Roasting Maven

Re: 500 ways to print [1..10]!

 
0
  #69
Nov 14th, 2006
How about one with a recursive function?


#include <stdio.h>
 
int count(int);
 
int main()
{
    return count(0);
}
 
int count(int iTeller)
{
    iTeller++;
    printf("%d ", iTeller);
    if (iTeller < 10)
        count(iTeller);
    else 
        return 0;
}
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: 500 ways to print [1..10]!

 
0
  #70
Nov 14th, 2006
how about a function that could, potentially, print 1...10 =P

(in Perl)
for(my($i) = 2; $i <= 11; $i++){
  print int(rand()*$i);
  print " ";
};

very silly.
Last edited by MattEvans; Nov 14th, 2006 at 10:21 pm.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the IT Professionals' Lounge Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC