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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [inline.java] - Blame information for rev 765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
public class inline
2
{
3
  static int factorial_1 (int n)
4
  {
5
    if (n > 0)
6
      return n * factorial_1(n-1);
7
    return 1;
8
  }
9
 
10
  static int factorial_2 (int n)
11
  {
12
    if (n > 0)
13
      return n * factorial_3(n-1);
14
    return 1;
15
  }
16
 
17
  static int factorial_3 (int n)
18
  {
19
    if (n > 0)
20
      return n * factorial_2(n-1);
21
    return 1;
22
  }
23
 
24
  public static void main(String args[])
25
    {
26
      if (factorial_1 (5) != 120)
27
        System.out.println("This should not happen");
28
      else
29
        System.out.println("OK");
30
      if (factorial_2 (5) != 120)
31
        System.out.println("This should not happen");
32
      else
33
        System.out.println("OK");
34
    }
35
}

powered by: WebSVN 2.1.0

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