#include <stdio.h>
int main(int argc, char *argv[])
{
int lcm,i,num1,num2,max_value=0;
num1=atoi(argv[1]);
num2=atoi(argv[2]);
max_value=(num1>num2)?num1:num2;
while(1){//Always true till we get the lcm
if(max_value%num1==0&&max_value%num2==0){
printf("LCM is :%d",max_value);
break;
}
++max_value;
}
return 0;
}
int main(int argc, char *argv[])
{
int lcm,i,num1,num2,max_value=0;
num1=atoi(argv[1]);
num2=atoi(argv[2]);
max_value=(num1>num2)?num1:num2;
while(1){//Always true till we get the lcm
if(max_value%num1==0&&max_value%num2==0){
printf("LCM is :%d",max_value);
break;
}
++max_value;
}
return 0;
}
No comments:
Post a Comment