This was a question on a quiz we had in my programming course. The answer is 70 as the output, but I'm having trouble understanding why. Could someone please tell me, step by step, why that comes out to be the output?
1. public class MysteriousClass { 2. public static void main(String[] args) { 3. int i = 20; 4. int b = m2(i); 5. System.out.println(b + i); 6. } 7. public static int m1(int i){ 8. int n = 0; 9. while (n * n <= i){ 10. n++; 11. } 12. return n - 1; 13. } 14. public static int m2(int a){ 15. int b = 0; 16. for (int n = 0; n < a; n++){ 17. int i = m1(n); 18. b = b + i; 19. } 20. return b; 21. } 22. }