Docsity

Java Program to Find Unique Age Combinations for CS 1410 Extra Credit Lab #1 - Prof. Delro, Lab Reports of Computer Science

Toggle sidebar
bg1
Page 1 of 1
CS 1410 Extra Credit Lab #1
Write a Java program to find the ages of three children such that the square of the sum of the
ages is the same as the product of the three ages. That is, for ages a0, a1, and a2
(a0 + a1 + a2)2 = a0 × a1 × a2
Display all possible unique combinations for ages below 20 (this excludes the same ages but in a
different order). Finding the unique ages is the hard part! Hint: the “trick” with the tree program
was choosing an appropriate ending pont for the loops; for this program, think about finding an
appropriate starting point for the loops.

Partial preview of the text

Download Java Program to Find Unique Age Combinations for CS 1410 Extra Credit Lab #1 - Prof. Delro and more Lab Reports Computer Science in PDF only on Docsity!

Page 1 of 1

CS 1410 Extra Credit Lab

Write a Java program to find the ages of three children such that the square of the sum of the ages is the same as the product of the three ages. That is, for ages a 0 , a 1 , and a (^2)

(a 0 + a 1 + a 2 ) 2 = a 0 × a 1 × a (^2)

Display all possible unique combinations for ages below 20 (this excludes the same ages but in a different order). Finding the unique ages is the hard part! Hint: the “trick” with the tree program was choosing an appropriate ending pont for the loops; for this program, think about finding an appropriate starting point for the loops.