Ask: I wrote the "minimum male number and the biggest number of conventions"? Debug is problematic !!

xiaoxiao2021-03-05  25

#include #include

INT main (void) {Int N, M, I, J, K, TEMP, R, P1, P2; Printf ("Input Two Integers:"); Scanf ("% D% D", & n, & M);

IF (n> m) / * guarantee m n * /

{TEMP = N; n = m; m = Temp;} for (i = 1; i <= n; i ) / * to obtain the maximum number of conventions * / if (M% i == 0 && n% i == 0) R = i; for (j = 1; j <= n; j ) / * solve the least common multiple * / {for (k = 1; k <= m; k ) {p1 = j * m; p2 = k * n ; If (p1 == p2) / *, you can jump out * / Break;}}}} PRINTF ("Maximum number of conventions:% d / n", r); Printf ("Minimum male:% D / N", P1) ;

System ("pause"); return 0;}

转载请注明原文地址:https://www.9cbs.com/read-34682.html

New Post(0)