Hi all, is anyone able to help me out with this problem below pls?
Basically i want to write a java prog that calculates the factorials of all integers up to 20! and outputs the result in the form:
1=1
2*1 =2
3*2*1=6
4*3*2*1=24
............
//my piece of code
class Factorial
{
public static void main(String []args)
{
int result =1;
for( int counter = 1; counter <= 20; counter++)
{
result = result * counter;
System.out.println(result);
}
}
}
the code above ouputs only the results and not the values before the equal sign (ie 3*2*1...) Hows it possible to make the values b4 the equal sign show as well as the results.any help would be appreciated.





Bookmarks