Problem Statement
Find the HCF of 12 and 18.
Explanation
HCF or Highest Common Factor is the largest number that divides both numbers completely. We can find it using prime factorization or division method.
Prime factorization: 12 equals 2 squared times 3. 18 equals 2 times 3 squared. HCF equals product of common prime factors with lowest powers equals 2 to the power 1 times 3 to the power 1 equals 6. Division method: Divide larger by smaller. 18 divided by 12 gives quotient 1 and remainder 6. Now divide 12 by 6 giving quotient 2 and remainder 0. So HCF equals 6.
Code Solution
SolutionRead Only
// Method 1: Prime Factorization // 12 = 2² × 3 // 18 = 2 × 3² // HCF = 2¹ × 3¹ = 6 // Method 2: Euclidean Algorithm // HCF(18, 12): // 18 = 12 × 1 + 6 // 12 = 6 × 2 + 0 // HCF = 6 // Method 3: Division // Factors of 12: 1, 2, 3, 4, 6, 12 // Factors of 18: 1, 2, 3, 6, 9, 18 // Common: 1, 2, 3, 6 // Highest: 6
Practice Sets
This question appears in the following practice sets:
