Write a method called friendly Numbers that accepts two 4-digit integer parameters n1 and n2. The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a method called friendly Numbers that accepts two 4-digit integer parameters n1 and n2. The method will display whether n1 and n2 are friendly number or not. The header of the method is: public static void friendlyNumbers (int n1, int n2) Note that two integers are friendly if the first digit and the last digit of both numbers are the same. For example 3451 and 3981 are friendly numbers because both numbers starts with 3 and ends with 1, but 3450 and 4650 are not. Write a method called friendly Numbers that accepts two 4-digit integer parameters n1 and n2. The method will display whether n1 and n2 are friendly number or not. The header of the method is: public static void friendlyNumbers (int n1, int n2) Note that two integers are friendly if the first digit and the last digit of both numbers are the same. For example 3451 and 3981 are friendly numbers because both numbers starts with 3 and ends with 1, but 3450 and 4650 are not.
Expert Answer:
Answer rating: 100% (QA)
class GFG Returns sum of all factors of n static int sumofFactorsint n Traversing through ... View the full answer
Posted Date:
Students also viewed these programming questions
-
Write a method called subMap that accepts two maps from strings to strings as its parameters and returns true if every key in the first map is also contained in the second map and maps to the same...
-
Write a method called isIsoceles that accepts three integer parameters that represent the lengths of the sides of a triangle. The method returns true if the triangle is isosceles but not equilateral...
-
Write a method called larger that accepts two floating point parameters (of type double) and returns true if the first parameter is greater than the second, and returns false otherwise.
-
Use Eq. (6) to estimate Af = f(3.53, 8.98) - f(3.5,9)
-
How much of the smooth transition, if any, do you think comes from both companies glossing over real differences in an effort to make the merger work?
-
The Yo-yo A yo-yo is made from two uniform disks, each with mass m and radius R, connected by a light axle of radius b. A light, thin string is wound several times around the axle and then held...
-
White Mountain Corporation (WMC) sells computer components. It is a publicly traded corporation. William serves as WMCs Chief Executive Officer (CEO). William owns 15 percent of WMCs outstanding...
-
1. Develop forecasts using regressions of sales on each of the series of rain forecasts respectively. Calculate the MFE (bias), MAD, and MAPE for the two forecasting models. Which rain forecast seems...
-
6. An igloo, a hemispherical enclosure built of ice (1.67 J/m-sC), has as inner radius of 2.50m. The thickness of the ice is 0.5m. At what rate must thermal energy be generated to maintain the air...
-
The chief financial officer for Eagles Beach Wear and Gift Shop is planning for the companys cash flows for the next six months. The following table summarizes the expected accounts receivables and...
-
Suppose the payment are only $16,000 each, but they are made every six months, starting six months from now. what would be the future value if the ten payments were invested at 10.0 percent annual...
-
247. A tall sailing ship (m = 1.43 104 kg) is initially at rest. A steady wind blows at the 60 angle shown in the diagram and moves the ship forward a distance of 850 m. The ship's final speed is 9.0...
-
The owners of the USHL stated they can tolerate 5 - yrs of operations if their team is sustainable after that time. At the end of the 5 - yrs , which team ( s ) will cease operations? Which team ( s...
-
describe the mechanisms by which the nucleus responds to environmental stimuli or stressors, such as DNA damage, viral infections, or changes in nutrient availability?
-
Public and Private Goods In a New Year Pary, you need to decide how much money to spend on cans of beer (b, standing for the number of cans of beer) and how much to spend on fireworks (f, standing...
-
A computer call center is going to replace all of its incandescent lamps with more energy efficient fluorescent lighting fixtures. The total energy savings are estimated to be $2,104 per year, and...
-
An electron of mass m, subjected to an electromagnetic force F follows a path described by the position vector F = (ecos(at) + bt) + esin(at)] where t represents time and e and b are positive...
-
A bubble-point liquid feed is to be distilled as shown in Figure. Use the Edmister group method to estimate the mole-fraction compositions of the distillate and bottoms. Assume initial overhead and...
-
What are the six books of original entry?
-
Show the journal entries necessary to record the following items: 2017 Apr 1 Bought office furniture on credit from Durham Brothers Ltd 1,400. 4 We take goods costing 270 out of the business...
-
You are to open the books of F. Polk, a trader, via the journal to record the assets and liabilities, and are then to record the dialy transactions for the month of May. A trial balance is to be...
Study smarter with the SolutionInn App