LOLCODE!
Posted: 2007-10-27 11:49pm
Hai!
I has a link!
This guy's prime factoring program
I has a link!
Code: Select all
HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE
Code: Select all
HAI
CAN HAS STDIO?
I HAS A VAR
GIMMEH VAR
VISIBLE "You said " N VAR N " !!"
KTHXBYE
Code: Select all
BTW LolCode Implementation of a program I had to write for my Java class, a long time ago.
BTW LolCode Spec 1.2, with GOIN UP/DOWN as laid out here: http://forum.lolcode.com/viewtopic.php?pid=2406#p2406
BTW There might be some syntax/usage/logic errors around, but that's to be expected in a language that's still forming and doesn't have a standard compiler.
HAI
BTW Define some useful functions
HOW DUZ I SGN YR SPEECHINGS
GOIN DOWN 0 AN SPEECHINGS MKAY
O RLY?
YA RLY
FOUND YR -1
NO WAI
FOUND YR 1
OIC
IF U SAY SO
HOW DUZ I ABS YR SPEECHINGS
FOUND YR PRODUKT OF SPEECHINGS AN SGN SPEECHINGS
IF U SAY SO
I HAS A WHATUSAY
I HAS A factor1 ITZ 1
I HAS A factor2 ITZ 0
I HAS A numOfFactors ITZ 0
VISIBLE "Input a number to be factored."
GIMME WHATUSAY
WHATUSAY IS NOW A NUMBR
VISIBLE "Factors of " AN WHATUSAY AN ":"
IM IN YR loop
GOIN UP ABS WHATUSAY AN PRODUKT OF factor1 AN factor1 MKAY
O RLY?
YA RLY
GTFO
OIC
BOTH SAEM 0 AN MOD OF WHATUSAY AN factor1
O RLY?
YA RLY
factor2 R QUOSHUNT OF WHATUSAY AN factor1
numOfFactors R SUM OF numOfFactors AN 1
VISIBLE "[" AN factor1 AN "," AN factor2 AN "]"
VISIBLE "[" AN PRODUKT OF factor1 AN -1 AN "," AN PRODUKT OF factor2 AN -1 AN "]"
OIC
factor1 R SUM OF factor1 AN 1
IM OUTTA YR loop
BOTH SAEM 1 AN numOfFactors
O RLY?
YA RLY
VISIBLE "Note: This number is a prime number."
OIC
KTHXBYE