//Find LCM of two positive integers with c Programming
#include <stdio.h>
int main()
{
int i, j, k;
printf("Enter First positive integers: ");
scanf("%d", &i);
printf("Enter First positive integers: ");
scanf("%d", &j);
k=(i>j) ? i : j;
while(1)
{
if(k%i==0 && k%j==0)
{
printf("LCM of %d and %d is : %d", i, j,k);
break;
}
++k;
}
return 0;
}
Result :
#include <stdio.h>
int main()
{
int i, j, k;
printf("Enter First positive integers: ");
scanf("%d", &i);
printf("Enter First positive integers: ");
scanf("%d", &j);
k=(i>j) ? i : j;
while(1)
{
if(k%i==0 && k%j==0)
{
printf("LCM of %d and %d is : %d", i, j,k);
break;
}
++k;
}
return 0;
}
Result :
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন