Attachment 'JasminFaculty.j'
Download 1 .class public Faculty
2 .super java/lang/Object
3
4 .method public static main([Ljava/lang/String;)V
5 .limit stack 2
6 .limit locals 3
7 ldc 10 ; calculate the faculty of this number (n)..
8 istore 1 ; store n into variable 1, 0 used for string array...
9 iconst_1 ; initialize result with 1
10 istore 2 ; store result into local variable 2
11 Label1:
12 iload 1 ; load n and result, multiply them
13 iload 2
14 imul
15 istore 2 ; store new result in resultvariable
16 iload 1 ; subtract 1 from n..
17 iconst_1 ;
18 isub
19 istore 1 ; store n again...
20 iload 1 ;
21 ifgt Label1 ; if n greater 0, continue loop...
22
23
24 iload 2 ; output result
25 getstatic java/lang/System/out Ljava/io/PrintStream;
26 swap
27 invokevirtual java/io/PrintStream/println(I)V ; print x
28 return ; return from main
29
30 .end method
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.