Welcome Guest.


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 March 17, 2023



int Main () {

int n, m;

cin>> n>> m;

int FAC = 1;

for (int i = 2; i <= n; i ++)

FAC *= i;

FAC %= m;


Return 0;


1 Answers

  1. +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

    Louis Jackson- March 17, 2023 |