
Code: Alles auswählen
PROGRAM einmaleins
DO i=1,10
WRITE(*,1001) (i, j, i*j, j=1,10)
ENDDO
1001 FORMAT (10(I2, ' x ', I2, ' = ', I3, /))
END PROGRAM
Code: Alles auswählen
PROGRAM einmaleins
DO i=1,10
WRITE(*,1001) (i, j, i*j, j=1,10)
ENDDO
1001 FORMAT (10(I2, ' x ', I2, ' = ', I3, /))
END PROGRAM
Code: Alles auswählen
(ns one-times-one
(:use [clojure.contrib.combinatorics :only (cartesian-product)]))
(let [maximum 10
numbers (range 1 (+ maximum 1))
combinations (cartesian-product numbers numbers)]
(doseq [[a b] combinations]
(printf "%d * %d = %d\n" a b (+ a b))))
Hey, ich hatte tatsächlich überlegt, aber musste dann leider mal losLeonidas hat geschrieben:Mit etwas Glück bin ich diesmal schneller als Hyperion![]()
Code: Alles auswählen
10 FORA=1TO10:FORB=1TO10:PRINTB"X"A"="A*B:NEXTB:PRINT:NEXTA
Code: Alles auswählen
(module test (main main))
(define
(main argv)
(let outer
((a 1))
(if (<= a 10)
(begin (let inner
((b 1))
(if (<= b 10)
(begin (print b " * " a " = " (* a b))
(inner (+ b 1)))))
(newline)
(outer (+ a 1))))))
Stimmt. Das ging ja auch ohneBlackJack hat geschrieben:Scheme (mit Bigloo zu übersetzen):
@Hyperion: Bei den ``NEXT``\s könntest Du noch die Variablennamen weglassen. Du Speicherplatzverschwender.
Code: Alles auswählen
1 to: 10 do: [:a |
1 to: 10 do: [:b |
Transcript show: ('{2} x {1} = {3}' format: { a. b. a * b. }); cr. ].
Transcript cr. ].
Code: Alles auswählen
(defun cartesian-product (a b)
(loop for i in a
nconc (loop for j in b
collect (list i j))))
(flet ((range (min max)
(loop for i from min to max
collect i)))
(let ((numbers (range 1 10)))
(loop for (i j) in (cartesian-product numbers numbers)
do (format t "~d * ~d = ~d~%" i j (* i j)))))
Code: Alles auswählen
.zero
a .byte 0
b .byte 0
c .byte 0
.text
.word $1000
*=$1000
lda #1 ; a = 1
sta a
outer_loop
ldx #1 ; b = 1
stx b
dex ; c = 0
stx c
lda #13 ; print newline before block
jsr $ffd2
inner_loop
clc ; c += a
lda c
adc a
sta c
ldx b ; print b
jsr print_byte
lda #'*' ; print "*"
jsr $ffd2
ldx a ; print a
jsr print_byte
lda #'=' ; print "="
jsr $ffd2
ldx c ; print c
jsr print_byte
lda #13 ; print newline
jsr $ffd2
inc b ; b += 1
lda #11 ; if b != 11 then repeat loop
cmp b
bne inner_loop
inc a ; a += 1
cmp a ; if b != 11 then repeat loop
bne outer_loop
rts ; bye...
;---------------------------------
; Print byte value in X register.
print_byte
lda #0
jmp $bdcd
Code: Alles auswählen
#include <iostream>
template <int M, int N>
struct Value {
static void print() { std::cout << M << " * " << N << " = " << M*N << std::endl; }
};
struct Null {
static void print() { };
};
template <typename H, typename T>
struct List {
typedef H Head;
typedef T Tail;
static void print() { Head::print(); Tail::print(); }
};
template <int M, int I, int X>
struct Range {
typedef List<Value<M, X>, typename Range<M, I-1, X+1>::Result> Result;
static void print() { Result::print(); }
};
template <int M, int X>
struct Range<M, 0, X> {
typedef Null Result;
static void print() { }
};
template <int M, int N, int X>
struct Row {
typedef List<typename Range<X, N, 1>::Result, typename Row<M-1, N, X+1>::Result> Result;
static void print() { Result::Head::print(); Result::Tail::print(); }
};
template <int N, int X>
struct Row<0, N, X> {
typedef Null Result;
static void print() { }
};
template <int N, int M>
struct Result {
typedef Row<N, M, 1> Data;
static void print() { Result::print(); }
};
int main(int argc, char **argv) {
Result<10, 10>::Data::print();
}
Code: Alles auswählen
#include <iostream>
template <int M, int N>
struct Mult {
static void print() {
std::cout << M << " * " << N << " = " << M*N << std::endl;
}
};
template <int M, int X, int I>
struct Inner {
static void print() {
Mult<M, X>::print();
Inner<M, X+1, I-1>::print();
}
};
template <int M, int X>
struct Inner<M, X, 0> {
static void print() { }
};
template <int M, int X, int I>
struct Outer {
static void print() {
Inner<X, 1, M>::print(); Outer<M, X+1, I-1>::print();
}
};
template <int M, int X>
struct Outer<M, X, 0> {
static void print() { }
};
template <int M>
struct Einmaleins {
static void print() { Outer<M, 1, M>::print(); }
};
int main(int argc, char ** argv) {
Einmaleins<10>::print();
}
Code: Alles auswählen
<?php
foreach(range(1,10)as $a) {
foreach(range(1,10) as $b) {
print "$a x $b = ".$a*$b."\n";
}
}
?>
Code: Alles auswählen
++++++++++>>++++++[<+++++++>-]+>++++++[<++++++++++>-]>++++[<++++++++>-]>>+>>+><
<<<++++++++++[<++++++++++>-]<[>>>>><<<<[>>>>>>+>+<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>
>>-]<-[<<+>+>-]<<[>>+<<-]+>[<->[-]]<[<<<<->>>>[-]]>[-]>[-]>[-]<<<<<<<<-[>>>>>+>
+<<<<<<-]>>>>>>[<<<<<<+>>>>>>-]<>++++++++++<[->>+<-[>>>]>[[<+>-]>+>>]<<<<<]<<<[
-]++++++++++>>>>>[<<<<<->>>>>-]<<<[-]++++++++++>>>>[<<<<->>>>-]<<<<<<[>>>>>>>+>
+<<<<<<<<-] >>>>> >>>[<<<<<<<<+>>>>>>>>-]++++++++++[<->-]<<<[-]>[-]>[<<+>+>
-]<<[>>+<<-] +>[ <->[-]]<[<<<<<---------<[>>>>>>>+>+<<<<<<<<-]>>>>>>>>[<<<<
<<<<+>>>>>>>> - ]<<[ -]<[-] > > [<<+>+> -]<<[ > >+<<-]+>[<<
<<<<->>>>>>->[ -]]<[< <<<- <+ > >>>> -]> [-] ] <<[-]>[-]>
[-]>[-]>[-]<<<< <[>>>>>+ >+ <<< <<<- ]> >>>>> [< <<<< <+>>>>>>-
]++++++++++[<- >-]<<<[- ]>[- ]>[<< +> +>-]<<[ >> +<<-] +>[<->[-]
]<[<<<------- - --<[-]+> >>>[- ]]<<[ -] >[-]> [- ]>[-] >[-]>[-]<
<<++++[<<<<< <[> >>>+>+<< <<<-]> >>>>[ <<< <<+ >>> >>-]+ +++++[<++
++++++>-]>- [>+<- ]>]<<<< <<.>.< <<<<< <.<<. >>.>> >>>>> >.>.<<<<<
<<<<.<.>.>>>>>>>>>>+++++ ++ +++++[<----<----<----<---->>>>-]<<<<[>>>>++++++++
++<<<<-]>[>>>+<<<-]>[>>>+ +++++++++<<<-]>[>>+<<-]>[>[>+>+<<-]>>[<<+>>-]<<<-]
>>>>++++++++++[<++++++++++ >-]<<[->>+<-[>>>]>[[<+>-]>+>>]<<<<<]>>>[-<<<<<<<<+>
>>>>>>>]++++++++++<[->>+<-[>>>]>[[<+>-]>+>>]<<<<<]>>>[-<<<<<<<<<+>>>>>>>>>]<[-<
<<<<<<+>>>>>>>]<<<<<<[-]>[-]>[-]>[-]<<<<<<<++++++++++++[>++++>++++>++++<<<-]>.>
.>.<<<<<<<<<<<<.>>>>>>>>>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]<<<<<<<<<<<<<<]
Code: Alles auswählen
select a, b, a*b as result from generate_series(1,10) as a(a), generate_series(1,10) as b(b)
Aus einem Grund nennt sich die Sprache ja auch BrainfuckXynon1 hat geschrieben:Na, bestens gelaunt und völlig erledigt(Ich für meinen Teil zumindest), vorallem mein Gehirn. Habe gestern den Abend von 22:30-ca. 2:00Uhr an diesem verdammten Script gesessen und heute meine Mittagspause damit verbracht es fertig zustellen