0

Python

def counting(i=0):
    while i < 11:         
        print i,
        i += 1
 
counting()

slightly shorter way in python

print range(1,11)
0

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...

0

how about a competition for most obfuscated :)
C++

#include <iostream>

int main()
{
    int _0(0);
    while("\"#$%&\'()*+,"[_0]!=',')
        std::cout<<static_cast<int>("\"#$%&\'()*+"[_0++]-'!')<<" ";
}
0

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;
}
0

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;
}
0

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.

0

Another Perl version:

s/./'print "'.(-64+ord $&)."\n\""/gee for $x = "ABCDEFGHIJ"

"print [1..10]" you say? Funny you should mention that!

A Haskell version:

main = print [1..10]
0
#include <iostream.h>
#include <stdlib.h>

void printNumbers();

const NUMBERS = 10;

void main()
{
    printNumbers();
    system("pause");
}

void printNumbers()
{
   int numberArray[NUMBERS];

    for(int i = 0; i < NUMBERS; i++)
   {
       numberArray[i] = i;
   }

   for(int i = 0; i < NUMBERS; i++)
   {
       cout << (numberArray[i] + 1) << endl;
   }
}
0

Not Asm, Basic, C but --> D

import std.stdio;

void main(char[][] args)
{
    writefln("1 2 3 4 5 6 7 8 9 10");

}

And void main() is allowed in D ;)

Regards Niek

0

Very simple one in brainfuck:

+++++++++++++++++++++++++++++++++++++++++++++++++.+.+.+.+.+.+.+.+.--------.-.

It really doesn't get any simpler...

Niek

[edit] hmmm... that's not the name of the language... ;) [/edit]

0

Very simple one in brainfuck:

+++++++++++++++++++++++++++++++++++++++++++++++++.+.+.+.+.+.+.+.+.--------.-.

It really doesn't get any simpler...

Sorry, it does :)

++++[>++++[>+++>+++<<-]<-]>>+.+.+.+.+.+.+.+.+.>+.-.
0

Sorry, it does :)

I meant for the programmer, your program uses loops which I don't really master in Brainfck.

Now for something in Cow

MoO MoO MoO MoO MOO moO MoO MoO MoO MOO moO MoO MoO MoO moO MoO MoO MoO mOo mOo MOo moo mOo MOo moo  moO moO MoO OOM MoO OOM MoO OOM MoO OOM MoO OOM MoO OOM MoO OOM MoO OOM MoO OOM moO MoO OOM MOo OOM

That sucked, it's even more confusing then BF...

Niek

0

Lets sort in Common Lisp (Lispworks interpreter):

>> (defun main () (format t "~s" (sort '(10 4 3 2 5 9 8 7 1 6) #'<)) )
 
>> (main)
1
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Count1to10
{
    /// <summary>
    /// Summary description for Form1.
    /// </summary>
    public class formCounter : System.Windows.Forms.Form
    {
        private System.Windows.Forms.Button btnGo;
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public formCounter()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if (components != null) 
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.btnGo = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // btnGo
            // 
            this.btnGo.Location = new System.Drawing.Point(112, 112);
            this.btnGo.Name = "btnGo";
            this.btnGo.TabIndex = 0;
            this.btnGo.Text = "GO!";
            this.btnGo.Click += new System.EventHandler(this.btnGo_Click);
            // 
            // formCounter
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(292, 266);
            this.Controls.Add(this.btnGo);
            this.Name = "formCounter";
            this.Text = "Counter";
            this.ResumeLayout(false);

        }
        #endregion

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() 
        {
            Application.Run(new formCounter());
        }

        private void btnGo_Click(object sender, System.EventArgs e)
        {
            for (int i=1; i < 11; i++)
            {
                MessageBox.Show(i.ToString());
            }
        }
    }
}

Nice...

Votes + Comments
Daj nemoj zajebavati da si iz Kikinde! Pa ja sam ziveo preko galacke
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.