Answers

2014-04-06T11:33:38+05:30
int main()
{
int num1, num2,num3, max,ans;
printf("Enter three positive integers: ");
scanf("%d %d %d", &num1, &num2,&num3);
max=(num1>num2) ? num1 : num2;    /* maximum value is stored in variable max */ while(1)           /* Always true. */
{
  if(max%num1==0 && max%num2==0)
   {
    break;       /* while loop terminates. */
     }
++max;
}

ans=(max>num3) ? max : num3; /* maximum value is stored in variable ans */
 while(1)        /* Always true. */
{   
   if(ans%num1==0 && ans%num2==0)
   {
     printf("LCM of %d and %d is %d", max, num3,ans);
     break;         /* while loop terminates. */
     }
++ans; 

 }
return 0;
}

0
Which programming language
c programming language
c++