Help me please ?..

Thread Starter

ghaya

Joined Apr 15, 2012
1
Hi.. :confused::(

I Take Microprocessor and firmware and I have some problems

i have 3 Q

1- Write the code for an algorithm to replace the most frequent element in the matrix with the geometric mean of its diagonal.

2-Find the largest palindrome made from the product of two 3-digit numbers.

3-What is the smallest number divisible by each of the numbers 1 to 20?

all we need to write the code for them :( i solved 7 Q but this 3 i can't

Help me :(

thank you .. :confused:
 

panic mode

Joined Oct 10, 2011
2,715
geometric mean of diagonal is \(sqrt(a11*a22*a33*a44...)\)
to find which element is most common, you need to count occurrence of each value.
then go through matrix and do replacements

palindrome is number or word that reads same way forward and backwards.
brute force method works too, find products of all 3-digit numbers until you get palindrome. i'd start from large numbers because we are looking for max product.

factor all numbers 1..20, remove redundant factors and multiply the rest.
 
Top