注意:此页面搜索的是所有试题
29. (问答题)
public class Class1 {
public static void main( String args[] )
{
Fact N = new Fact( 4 );
System.out.println( N.fact( ) );
}
}
class Fact {
int n ;
Fact( int nn ) { n = nn; }
int fact( ) {
int i , f = 1;
for ( i=1; i<=n; i++ )
f = f*i;
return f;
}
}
public class Class1 {
public static void main( String args[] )
{
Fact N = new Fact( 4 );
System.out.println( N.fact( ) );
}
}
class Fact {
int n ;
Fact( int nn ) { n = nn; }
int fact( ) {
int i , f = 1;
for ( i=1; i<=n; i++ )
f = f*i;
return f;
}
}
参考答案