fork download
  1. class Main {
  2. public static void main (String[] args) {
  3. int f = 1;
  4. int c = 5;
  5. String s = "";
  6. while (c > 1) {
  7. f *= c;
  8. s += c + " x " ;
  9. c--;
  10. }
  11. s += c;
  12. System.out.println(s + " = " + f);
  13. }
  14. }
  15.  
  16. //https://pt.stackoverflow.com/q/150555/101
Success #stdin #stdout 0.13s 36272KB
stdin
Standard input is empty
stdout
5 x 4 x 3 x 2 x 1 = 120