Question: 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
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.
Step by Step Solution
3.49 Rating (166 Votes )
There are 3 Steps involved in it
class GFG Returns sum of all factors of n static int sumofFactorsint n Traversing through ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
6364f3e99b6d4_239888.pdf
180 KBs PDF File
6364f3e99b6d4_239888.docx
120 KBs Word File
