The problem of the factor, the number of steps of the number of steps of the number of steps.
In the specific algorithm, there is the most simple multiplication idea, please distinguish your taste.
#include
INT main () {int N; // Section size Printf ("Please enter the size of N:"); scanf ("% d", & n); // receive step-by-size INT A [200] from the keyboard; // The array of saves the final calculation results are large enough; // carry int digit = 1; // digits a [0] = 1; // will initialize the result to 1 int TEMP; // End of any element and temporary The results of the product results for the results for (int I = 2; i <= n; i) // start step-by-step, the step-by-step "debut" {// is considered by the most basic multiplication intention, Each position of the temporary result is multiplied by the step-by-step element (int J = 1, carry = 0; j <= DIGIT; J) {TEMP = a [j-1] * i carry; // One multiplication (plus carry) A [j-1] = temp% 10; // update the temporary result of the information carry = TEMP / 10; // See if it is carry } While (carry) // If you have inlet {a [ Digit-1] = carry% 10; // new plus one, add information. Number increase 1 carry / = 10; // Can not carry}}}
Printf ("result is: / n% D! =", n); // Display result for (int i = DIGIT; I> = 1; --i) {Printf ("% d", A [I-1 ]);} Return 0;}