c Language practice 16-- input two positive integers m and n, seeking the least common multiple of the greatest common divisor and

#include <stdio.h> 
#include <stdlib.h>
 / * Title: Enter two positive integers m and n, and seeking the least common multiple of the greatest common divisor * / 
int main () { 
System ( " Color 1F " );   // set the display frame for the blue white 
System ( " MODE CON Lines cols = 80 = 30 " );   // fixed display frame size 
/ * ****************** *********************** program body parting line (top) ******************************************************** **** * / 
int m, n-, Y, I; 
 the while ( . 1 ) { 
the printf ( " enter first number m: " ); 
Scanf ( " % D " , & m);
printf(" Please enter the second number n-: " ); 
Scanf ( " % D " , & n-);
 // to find common divisor 
for (I = . 1 ; I <= m; I ++ )
     IF (% I m == 0 % n-I == && 0 ) 
    Y = I; 
the printf ( " digital% d% d and the greatest common divisor of: []% d " , m, n-, Y);
 // then seek common multiple 
for (I = n-; I> = n-; I ++ )
     IF (% I m == 0 && n-I% == 0 )
     BREAK ; 
the printf ( "  The least common multiple of: []% d \ n ---------------------------------------- ------------------------------ \ n- " , I); 
}         
/ * ********** ******************************* program body parting line (bottom) ************ ************** * / 
    return  0 ; 
}

 

Guess you like

Origin www.cnblogs.com/gougouwang/p/11401721.html