Sunday, November 11, 2007

News



/**
* Write a description of class factorial here.
* Fraction
* @author (your name)
* @version (a version number or a date)
*/
public class factorial
{
int x;
double y;
void display(int n)
{
x=n;
int f=1,i;
int j;
double fact1=1.0;
double sum=0.0;
for(i=1;i<=n;i++)
{

for(j=1;j<=x;j++)
{
fact1=fact1*j;
}
sum=sum+i;
System.out.print(sum+" ");

}
}
double fact()
{


y=fact1;
return y;

}

}

No comments: