MCM
#include<conio.h>
#include<stdio.h>
main(){
int a, b, x, z, y=1, i=2;
printf("ingrese primer numero: n");
scanf("%d",&a);
printf("ingrese segundo numero: n");
scanf("%d",&b);
if (a<b){x=a; z=b;} else {x=b; z=a;}
do{
if (x%i==0){
if(z%i==0){
y=y*i;
x=x/i; z=z/i; i=2;
}
else i++;
}
else i++;
} while(i<=x);
y=y*z*x;
printf("el MCM es %d", y);
getch(); }

Mcm

  • 1.
    MCM #include<conio.h> #include<stdio.h> main(){ int a, b,x, z, y=1, i=2; printf("ingrese primer numero: n"); scanf("%d",&a); printf("ingrese segundo numero: n"); scanf("%d",&b); if (a<b){x=a; z=b;} else {x=b; z=a;} do{ if (x%i==0){ if(z%i==0){ y=y*i; x=x/i; z=z/i; i=2; } else i++; } else i++; } while(i<=x); y=y*z*x; printf("el MCM es %d", y); getch(); }