"Lcm of 2 numbers in c" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "Lcm of 2 numbers in c" answered properly. Developers are finding an appropriate answer about Lcm of 2 numbers in c related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like Lcm of 2 numbers in c. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on Lcm of 2 numbers in c.
Lcm of 2 numbers in c
// for finding lcm of 2 number . Can use this concept to find lcm of an array of number
#include <stdio.h>
int main() {
int n1, n2, max;
printf("Enter two positive integers: ");
scanf("%d %d", &n1, &n2);
// maximum number between n1 and n2 is stored in min
max = (n1 > n2) ? n1 : n2;
while (1) {
if (max % n1 == 0 && max % n2 == 0) {
printf("The LCM of %d and %d is %d.", n1, n2, max);
break;
}
++max;
}
return 0;
}
Copied
Source: www.programiz.com
All those coders who are working on the Whatever based application and are stuck on Lcm of 2 numbers in c can get a collection of related answers to their query. Programmers need to enter their query on Lcm of 2 numbers in c related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about Lcm of 2 numbers in c for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of Lcm of 2 numbers in c while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "Lcm of 2 numbers in c". Visit this developer's friendly online web community, CodeProZone, and get your queries like Lcm of 2 numbers in c resolved professionally and stay updated to the latest Whatever updates.