belongs to collection: Loops C Programs for Practice
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 .
#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:
Enter Two Positive Integers:
23 56
LCM of 23 and 56 is 1288
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Output:
Enter Two Positive Integers:
23 56
LCM of 23 and 56 is 1288