Looking for an inspiration? Below you will find public programs submitted by other users.

Filter by: All Bash C C# C++ 4.9.2 C++14 Haskell Java Java7 Objective-C Pascal (fpc) Pascal (gpc) Perl PHP Python Python 3 Ruby SQL VB.NET Ada Assembler Assembler AWK (gawk) AWK (mawk) bc Brainf**k C++ 4.3.2 C99 strict CLIPS Clojure COBOL COBOL 85 Common Lisp (clisp) D D (dmd) Erlang F# Factor Falcon Forth Fortran Go Groovy Icon Intercal JavaScript (rhino) JavaScript (spidermonkey) Lua Nemerle Nice Nimrod Node.js Ocaml Octave Oz PARI/GP Perl 6 Pike Prolog (gnu) Prolog (swi) Python (Pypy) R Scala Scheme (chicken) Scheme (guile) Smalltalk Tcl Text Unlambda Whitespace

#rsOZr7 Scala 8 hours ago
Compilation error
  1. object CaseClassInheritance {
  2. abstract class Person {
  3. def name: String
  4. def age: Int
  5. // address and other properties
  6. // methods (ideally only accessors since it is a case class)
  7. def getName(): String = {
  8. return name
  9. }
#agAyam Scala 11 hours ago
Runtime error
  1. object Main extends App {
  2. var line = readLine();
  3. while(false == line.equals("42")) {
  4. System.out.println(line);
  5. line = readLine();
  6. };
  7. }
#ADauRa Scala 11 hours ago
Compilation error
  1. define (do_it n)
  2. (define (print_it n)
  3. (display n)
  4. (newline))
  5. (cond ((not(= n 42))
  6. (print_it n)
  7. (do_it (read)))
  8. ))
  9.  
#isyNvQ Scala 11 hours ago
Compilation error
  1. > mkdir classes
  2. > scalac -d classes %SCALA_HOME%\doc\scala-devel-docs\scala\examples\sort.scala
  3. > scala -cp classes examples.sort
  4. [6,2,8,5,1]
  5. [1,2,5,6,8]
#9AL0Oy Scala 13 hours ago
Success
  1. object Main extends App {
  2. // your code goes here
  3. println("hello")
  4. }
#dkNSrz Scala 13 hours ago
Compilation error
  1. object Main extends App {
  2. // your code goes here
  3. println(hello)
  4. }
#p7qtFW Scala 13 hours ago
Compilation error
  1. object HelloWorld {
  2. /* This is my first java program.
  3.   * This will print 'Hello World' as the output
  4.   */
  5. def main(args: Array[String]){
  6. println("Hello, world!") // prints Hello World
  7. }
  8. }
#AtRnOn Scala 13 hours ago
Compilation error
  1. object HelloWorld {
  2. /* This is my first java program.
  3.   * This will print 'Hello World' as the output
  4.   */
  5. def main(args: Array[String]) {
  6. println("Hello, world!") // prints Hello World
  7. }
  8. }
#3wm1An Scala 13 hours ago
Compilation error
  1. object Starter {
  2. def main(args: Array[String]) {
  3. println("hello world")
  4. }
  5. }
  6.  
  7.  
#q5kbEu Scala 13 hours ago
Compilation error
  1. object Test{
  2. def main(args: Array[String]){
  3. for(n <- 1 to 100){
  4. if(n % 3 == 0 && n % 5 != 0){
  5. println("Fuzz")
  6. }
  7. else if(n % 3 != 0 && n % 5 == 0){
  8. println("Buzz")
  9. }
#0yWgqM Scala 14 hours ago
Compilation error
  1. import scala.swing._
  2. import scala.swing.BorderPanel.Position._
  3. import event._
  4. import java.awt.{ Color, Graphics2D }
  5. import scala.util.Random
  6.  
  7. object SimpleGUI extends SimpleSwingApplication {
  8.  
  9. def top = new MainFrame { // top is a required method
#UyFmtd Scala 12 hours ago
Success
  1. object Main extends App {
  2. var sum = 0
  3. var f0 = 1
  4. var f1 = 1
  5. while (f1 <= 4000000) {
  6. if (f1 % 2 == 0)
  7. sum += f1
  8. val nextf = f0 + f1
  9. f0 = f1
#jf42sH Scala 14 hours ago
Compilation error
  1. object Main extends App {
  2. var sum = 0
  3. for (i <- 1 to 1000)
  4. sum += if (i % 3 == 0 || i % 5 == 0) i else 0
  5. println(sum)
  6. }
#awrWJk Scala 21 hours ago
Success
  1. import java.io.File
  2.  
  3. object Pwd {
  4.  
  5. def main(args:Array[String]) {
  6. val file = new File(".")
  7. println(file.getCanonicalPath)
  8. }
  9. }
#Wsqkv7 Scala 22 hours ago
Success
  1. object Main extends App {
  2. // your code goes here
  3. var line = readLine();
  4.  
  5. System.out.println(line);
  6.  
  7. }
#AuNFW0 Scala 22 hours ago
Success
  1. object Main extends App {
  2. // your code goes here
  3.  
  4.  
  5. def f(a:Int, b:Int): Int = {
  6. val r = a + b
  7. + 1;
  8. return r;
  9. }
#h9tbt8 Scala 22 hours ago
Success
  1. object Main extends App {
  2.  
  3. val a = 123;
  4. val b = 123
  5. // your code goes here
  6. }
#sUuxuv Scala 21 hours ago
Success
  1.  
  2. object Hello {
  3.  
  4. def main(args:Array[String]) {
  5. println("Hello!")
  6. }
  7. }
#Eorlf6 Scala 1 day ago
Success
  1. object Main extends App {
  2. // your code goes here
  3. println("Testing")
  4. }
#MGuksG Scala 1 day ago
Compilation error
  1. package eulerProject
  2.  
  3. /**
  4.  * Problem 221: Alexandrian Longegers<br>
  5.  * 13 December 2008<br>
  6.  * <br>
  7.  * We shall call a positive integer A an "Alexandrian integer", if there
  8.  * exist integers p, q, r such that:<br>
  9.  * <br>
#KA6o4I Scala 1 day ago
Compilation error
  1. object Main extends App
  2. {
  3. val greeting: string = null
  4. var line = readLine();
  5. while(false == line.equals("42"))
  6. {
  7. System.out.println(line);
  8. line = readLine();
  9. };
#HGyVic Scala 1 day ago
Success
  1. object Main extends App {
  2. def toBits(byte: Byte): List[Int] = {
  3. (0 to 7).foldLeft(List[Int]())((list, i) => isBitSet(byte, i) :: list)
  4. }
  5.  
  6. private def isBitSet(byte: Byte, bit: Int) = ((byte >> bit) & 1)
  7.  
  8. val test = toBits(171.toByte);
  9. println(test)
#N7ngc1 Scala 1 day ago
Success
  1. object Main extends App {
  2. println("1 line before")
  3. System.exit(0)
  4. println("1 line after")
  5.  
  6. }
#yS2jeY Scala 1 day ago
Success
  1. object Main extends App {
  2. println("hello")
  3. }
#YsS53q Scala 1 day ago
Success
  1. object Main extends App {
  2. println("key=value".split('=').toList match {
  3. case head :: tail =>
  4. head -> tail.mkString
  5. })
  6. }
#NZjNSr Scala 1 day ago
Success
  1. object Main extends App {
  2. override def main(args: Array[String]) {
  3.  
  4. // We start with creating some examples:
  5. val definedInt: Option[Int] = Some(3)
  6. val undefinedInt: Option[Int] = None
  7.  
  8. def double(i: Int): Option[Int] = Option(2 * i)
#VdDKYx Scala 1 day ago
Compilation error
  1. object Main extends App {
  2. // We start with creating some examples:
  3. val definedInt: Option[Int] = Option(3)
  4. val undefinedInt: Option[Int] = Option(null)
  5.  
  6. def createDouble(i: Int): Option[Int] = Option(2 * i)
  7.  
  8. // Now let's get create String for each number or "empty" if there is no Int:
  9. val definedStr: String =
#puiwZG Scala 1 day ago
Success
  1. object Main extends App {
  2.  
  3. def f54(n :Int) :Boolean = {
  4. n match {
  5. case x if (x % 27 == 0) => (x/27) == 54
  6. case x if (x % 9 == 0) => (x/27 + (x/9)%3 + 3) == 54
  7. case x if (x % 3 == 0) => (x/27 + (x/3)%9 + 9) == 54
  8. case _ => (n/27 + n%27 + 27) == 54
  9. }
#Og26J5 Scala 1 day ago
Compilation error
  1. object Main extends App {
  2. None.hoge()
  3. println(None)
  4. }
#VN0nN1 Scala 2 days ago
Success
  1. object Main extends App {
  2. val mySeq = Seq(1, 2, 3)
  3.  
  4. println(mySeq.map(_ * 10).mkString(" -> "))
  5. }