1Answers
Please find the data that makes the following program error, use the output debugging method to determine the error sentence, and use the multiplication method to correct it to correct it
Asked by: David 11 views IT
#include
USING NAMESPACE STD;
int Main () {
int n, m;
cin>> n>> m;
int FAC = 1;
for (int i = 2; i <= n; i ++)
FAC *= i;
FAC %= m;
COUT << FAC;
Return 0;
}
+2Votes
The program has no syntax errors. It can be compiled and run
The possible problem is that the operation overflows. This can be seen at a glance
Paper scholars must output the debugging method, which can output the value of i, FAC in the loop, as follows
After the modification is modified, it should be like this