Saved Bookmarks
| 1. |
Write a Method to calculate and return the sum of the square of the digits of a number'n' using recursive technique.The method declaration is as follows:int sumSq(int n) |
Answer» Method to calculate and return the sum of the square of the digits of a number 'N' using recursive technique.Explanation:
public static int int sumSq(int n) { if (n < 10) return n^2; return (((n % 10)^2) +sumSq(n/10)); } Learn more about methods: Write a java program to compute the amount that has to be paid to a person (employee) using the following rules for calculating tax. What is the statement specifically called that involves a method in java |
|