Recent Posts

9-latest-250px-course

Write a C program to Find LCM of two numbers

Write a C program to Find LCM of two numbers



Program:-     

#include <stdio.h>

int main()

{

int a, b, lcm;

printf(“\nEnter two numbers: “);

scanf(“%d %d”, &a, &b);

lcm = (a > b) ? a : b;

while(1)

{

if( lcm % a == 0 && lcm % b == 0 )

{

printf(“\nLCM of %d and %d is %d\n”, a, b,lcm);

break;

}

++lcm;

}

return 0;

}

Output:-

....
SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment