Pages
Home
Hacking Tricks
Job & Interview
FunMaza
Movies
Studytonight
All Coupon
Android
Tuesday, 5 February 2019
8.Factorial program in java.
Description:
Write a sample code for Factorial in java..
Code:
?
1
2
3
4
5
6
public class FactorialNumber { public static void main(String[] args) { int i,fact=1; int number=5; for(i=1;i<=number;i++) { fact=fact*i; } System.out.println("Factorial of : "+number+"\n"+"Factorial is : "+fact); } }
Output:
Factorial of : 5 Factorial is : 120
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment