OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [inline.java] - Rev 765

Compare with Previous | Blame | View Log

public class inline
{
  static int factorial_1 (int n)
  {
    if (n > 0)
      return n * factorial_1(n-1);
    return 1;
  }
 
  static int factorial_2 (int n)
  {
    if (n > 0)
      return n * factorial_3(n-1);
    return 1;
  }
 
  static int factorial_3 (int n)
  {
    if (n > 0)
      return n * factorial_2(n-1);
    return 1;
  }
 
  public static void main(String args[])
    {
      if (factorial_1 (5) != 120)
	System.out.println("This should not happen");
      else
	System.out.println("OK");
      if (factorial_2 (5) != 120)
	System.out.println("This should not happen");
      else
	System.out.println("OK");
    }
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.