Problem :- Write A C Program to Find LCM of Two Numbers Using while Loop
Logic :- LCM ( Least Common Multiple ) also called the lowest common multiple or smallest common multiple If you have any question please let me know in comment Box .
Try Yourself Find The GCD of Array
Solution :-
Output:-
Logic :- LCM ( Least Common Multiple ) also called the lowest common multiple or smallest common multiple If you have any question please let me know in comment Box .
Try Yourself Find The GCD of Array
Solution :-
#include<stdio.h>
int main()
{
int num1, num2, max;
printf("Enter Two Positive Integers :\n");
scanf("%d %d", &num1, &num2);
max=(num1>num2) ? num1 : num2;
while(1)
{
if(max%num1==0 && max%num2==0)
{
printf("LCM of %d And %d is %d", num1, num2,max);
break;
}
++max;
}
return 0;
}
Output:-
SIr,in which IDE u run this C Code
ReplyDelete