C Program to find LCM of two numbers - c programs
//write a c program to find LCM of two numbers
//print LCM of two numbers in / using c language
What is LCM
LCM of two integers is a smallest positive integer which is multiple of both integers that it is divisible by the both of the numbers example: LCM of two numbers 9 and 6 is 18
//C Program to find LCM of two numbers
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y,z,i;
clrscr();
printf("Enter Two Numbers = ");
scanf("d%d",&x,&y);
for(i=1;i<=x*y*z;i++)
{
if(i%x==0&&i%y==0)
{
printf("LCM is %d\n",i);
break;
}
}
getch();
}
No comments:
Post a Comment