Programming with Java
Friday, 24 February 2012
Factorial
public
class
NumberFactorial
{
public
static
void
main
(
String
[
]
args
)
{
int
number
=
5
;
int
factorial
=
number
;
for
(
int
i
=
(
number
-
1
)
;
i
>
1
;
i
--
)
{
factorial
=
factorial
*
i
;
}
System
.
out
.
println
(
"Factorial of a number is "
+
factorial
)
;
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment