
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
Find the other number when LCM and HCF given in C++
Suppose we have a number A, and LCM and GCD values, we have to find another number B. If A = 5, LCM is 25, HCF = 4, then another number will be 4. We know that −
$$๐ด∗๐ต=๐ฟ๐ถ๐∗๐ป๐ถ๐น$$
$$๐ต= \frac{LCM*HCF}{A}$$
Example
#include <iostream> using namespace std; int anotherNumber(int A, int LCM, int GCD) { return (LCM * GCD) / A; } int main() { int A = 5, LCM = 25, GCD = 4; cout << "Another number is: " << anotherNumber(A, LCM, GCD); }
Output
Another number is: 20
- Related Articles
- Find HCF and LCM of 404 and 96 and verify that HCF$ร$LCM $ =$ Product of the two given numbers.
- Find HCF of 93 and 16 and from HCF find the LCM
- LCM and HCF of two numbers are 72 and 6 respectively. One of the numbers is 18. Find the other number.
- HCF and LCM
- The HCF of two numbers is 145 and their LCM is 2175. If one number is 725, find the other.
- Find the LCM and HCF of 16 and 24.
- Find the LCM and HCF of 13 and 17.
- Find the HCF and LCM of 96 and 404?
- Explain the HCF and LCM.
- Given that HCF (306, 657) $=$ 9, find LCM (306, 657).
- The LCM and HCF of two numbers are 180 and 6 respectively. If one of the numbers is 30, find the other number.
- Explain HCF and LCM.
- Find HCF and LCM of 4561, 6432, 457 ?
- The LCM of two numbers is 480 and their HCF is 24. If one of the numbers is 96, find the other number.
- LCM of 1566 and 2030 is 54810. Find the HCF.

Advertisements