Java

Factorial Program using Java

Factorial Program using Java
import java.io.*; 
class da 
{ 
public static void main(String arg[]) throws IOException 
{ 
DataInputStream d = new DataInputStream(System.in); 
int i,n,f; 
String s; 
f=1; 
System.out.print("enter the number : "); 
s = d.readLine(); 
n = Integer.parseInt(s); 
for(i=1;i<=n;i++) 
{ 
f = f * i; 
} 
System.out.println("\n"+"factorial of given number "+n+" is : " +f); 
} 
}
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.