Question
2. Write a script that calculates the common factors between 18 and 54. To find a common factor, you can use the modulo operator (%)
2. Write a script that calculates the common factors between 18 and 54. To find a common factor, you can use the modulo operator (%) to check whether a number can be evenly divided into both numbers. Hint, test will be something like 12 % 3 = 0 and 30 % 3 = 0 , the modulo gives you the remainder,if the remainder is zero then it is a factor. ie 10 and 30 are both divisible by 3. 4 is not a common factor because it does not divide evenly into both numbers. You will need a loop to complete this easily . Then, this script should print lines that display the common factors similar to this: Common factors of 18 and 54 1 2 .. and the remaining common factors, SQL
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started