0% found this document useful (0 votes)
63 views2 pages

Class Factorial: Public

JAVA PROGRAM TO FIND THE TRANSPOSE OF A MATRIX (A transpose of an array obtained by interchanging the elements of the rows and columns) . WITH COMMENTS AND DETAILS TO HELP YOU UNDERSTAND THEM.THIS PROGRAM HAS BEEN RUN ON BlueJ AND IS ERROR FREE.IT WILL SURELY HELP YOU IN STUDYING JAVA PROGRAMS FOR EXAMS OR OTHERWISE.

Uploaded by

AMRENDRA SINGH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views2 pages

Class Factorial: Public

JAVA PROGRAM TO FIND THE TRANSPOSE OF A MATRIX (A transpose of an array obtained by interchanging the elements of the rows and columns) . WITH COMMENTS AND DETAILS TO HELP YOU UNDERSTAND THEM.THIS PROGRAM HAS BEEN RUN ON BlueJ AND IS ERROR FREE.IT WILL SURELY HELP YOU IN STUDYING JAVA PROGRAMS FOR EXAMS OR OTHERWISE.

Uploaded by

AMRENDRA SINGH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Class factorial

1/1

import java.io.*;
public class factorial
{
int n;
int f;
DataInputStream d=new DataInputStream(System.in);
public factorial()
{
n=0;
f=0;
}
int fact(int num)//recursive method
{
if(num==0)//base case
{
return 1;
}
return (num*fact(num-1));//recursive case
}
void getnum(int x)
{
n=x;
f=fact(n);
System.out.println("FACTORIAL "+f);
}
void main()throws IOException
{
System.out.println("ENTER NUMBER");
int a=Integer.parseInt(d.readLine());
getnum(a);
}//end of main
}//end of class

Jan 16, 2015 11:18:27 PM

factoria1.main();
ENTER NUMBER
5
FACTORIAL 120
factoria1.main();
ENTER NUMBER
6
FACTORIAL 720

You might also like