The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled Java Code
Posted by: joao | April 21, 2011 @ 3:37pm
Java Code
[
Download
]
package pf; public class Fatorial{ private String fatorial; public void setFatorial(long n){ if(n==0||n==1) fatorial = "1"; else{ if(n<0) fatorial = "N�o existe fatorial para numeros negativos !"; else fatorial = "O fatorial de " + n + " � " + this.CalculaFatorial(n); } } public String getFatorial(){ return fatorial; } private long CalculaFatorial(long n){ long fat = n; for(int i = 1; n > i; n--) fat=fat*(n-1); return fat; } }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.52 / 8
193 Votes
http://codebin.yi.org/1232
page generated in 0.00 seconds