Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

MIPS , Where do i start :S

Write a MIPS assembly program that uses stack frames and carries out the same algorithm as the Java program given here.

public class Hail {

static int h(int n, int count) {
if (count == 0) return n;

if (n > 0x10)
return h( n & 0xf , count -1)

* h( n - 0x10, count-1);

if ( (n & 1) == 1) return h( n*3 + 1, count -1);
else return h ( n >>> 1, count);

}

public static void main( String [] argv) {
for (int i=1; i < 20; ++i)
System.out.println("hail("+i+",5) ="+h(i,5));
}

}
Sign In or Register to comment.