Off Topic Fun
Lots of fun to be had here
aptest2009freresponse lolcode!
HAI CAN HAS STDIO? VISIBLE "HAI WORLD!" KTHXBYE
Translation:
System.out.println("Hello World");
Try this one:
HAI CAN HAS STDIO? I HAS A VAR GIMMEH VAR IZ VAR BIGGER THAN 10? YARLY BTW this is true VISIBLE "BIG NUMBER!" NOWAI BTW this is false VISIBLE "LITTLE NUMBER!" KTHX KTHXBYE
Translation:
import java.util.Scanner;
public class LOL
{
public static void main(String[] args)
{
Scanner kb=new Scanner(System.in);
int var;
System.out.println("Give me a number:");
var = Integer.parseInt(kb.nextLine());
if (var>10){
//this is true
System.out.println("Big Number!");
} else {
//this is false
System.out.println("Little Number!");
}
}
}
Project Euler questions:
yay for things from here: Project Euler
curious, how can one find the numbers in the fibbonacci sequence?
The fibonacci sequence is 1, 1, 2, 3, 5, 8, ... Using mathematical language, a1=1, a2=1, and for n>2, an=an-1+an-2
Sounds like a job for recursion!
//precondition: n>0
public static int fibo( int n){
if (n==1 || n==2 ) return 1;
return fibo(n-1)+fibo(n-2);
}
