{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"The expression N!, read as \"N factorial,\" denotes the product of the \nfirst N positive integers, where N is nonnegative. So, for example, \n\u003cp\u003e N N! \u003cbr\u003e\n 0 1 \u003cbr\u003e\n 1 1 \u003cbr\u003e\n 2 2 \u003cbr\u003e\n 3 6 \u003cbr\u003e\n 4 24 \u003cbr\u003e\n 5 120 \u003cbr\u003e\n 10 3628800 \u003c/p\u003e\n\u003cp\u003eFor this problem, you are to write a program that can compute the last non-zero \n digit of the factorial for N. For example, if your program is asked to compute \n the last nonzero digit of 5!, your program should produce \"2\" because \n 5! \u003d 120, and 2 is the last nonzero digit of 120. \u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eInput\u003c/b\u003e\u003c/p\u003e\n\u003cp\u003eInput to the program is a series of nonnegative integers, each on its own line \n with no other letters, digits or spaces. For each integer N, you should read \n the value and compute the last nonzero digit of N!.\u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eOutput\u003c/b\u003e\u003c/p\u003e\n\u003cp\u003eFor each integer input, the program should print exactly one line of output \n containing the single last non-zero digit of N!.\u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eSample Input\u003c/b\u003e\u003c/p\u003e\n\u003cp\u003e1 \u003cbr\u003e\n 2 \u003cbr\u003e\n 26 \u003cbr\u003e\n 125 \u003cbr\u003e\n 3125 \u003cbr\u003e\n 9999 \u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eSample Output\u003c/b\u003e\u003c/p\u003e\n\u003cp\u003e1\u003cbr\u003e\n 2\u003cbr\u003e\n 4\u003cbr\u003e\n 8\u003cbr\u003e\n 2\u003cbr\u003e\n 8\u003cbr\u003e\n\u003c/p\u003e"}}]}