menu
QAmmunity.org
Login
Register
My account
Edit my Profile
Private messages
My favorites
Ask a Question
Questions
Unanswered
Tags
Categories
Ask a Question
Consider the recursive method myprint in this code snippet: public void myprint(int n) { if (n < 10) { system.out.print(n); } else { int m = n % 10; system.out.print(m); myprint(n / 10); } } what is printed for the call myprint(821)?
asked
May 7, 2018
67.6k
views
0
votes
Consider the recursive method myprint in this code snippet: public void myprint(int n) { if (n < 10) { system.out.print(n); } else { int m = n % 10; system.out.print(m); myprint(n / 10); } } what is printed for the call myprint(821)?
Computers and Technology
college
Celso Wellington
asked
by
Celso Wellington
8.0k
points
answer
comment
share this
share
0 Comments
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
1
Answer
6
votes
What the method does, is it takes the rightmost decade and prints it, then divides by 10 and repeats. Effectively this means the number is printed backwards, so the output is 128.
Przemyslaw
answered
May 11, 2018
by
Przemyslaw
8.0k
points
ask related question
comment
share this
0 Comments
Please
log in
or
register
to add a comment.
← Prev Question
Next Question →
Related questions
asked
Jul 12, 2022
75.5k
views
Consider the following code snippet: public static void print(E[] a) { for (int i = 0; i < a.length; i++) { System.out.println(a[i] + " "); } } int[] a = {3,6,5,7,8,9,2,3}; print(makeArray(a)); Assume that the method call to print(makeArray(a)) works correctly by printing the int array
Hou Lu
asked
Jul 12, 2022
by
Hou Lu
8.3k
points
Computers and Technology
college
1
answer
5
votes
75.5k
views
asked
Dec 16, 2024
50.3k
views
What is the purpose of the code snippet given below? static void Main() CArray nums = new CArray(); Random rnd = new Random(100); for(inti=0;i<10;i++) nums.Insert((int)(rnd.NextDouble() * 100)); nums.DisplayElements();
Udan
asked
Dec 16, 2024
by
Udan
8.2k
points
Computers and Technology
high-school
1
answer
2
votes
50.3k
views
asked
Aug 18, 2024
220k
views
Given the snippet of code: int x = 5; int bar(int j) { int *k = 0, m = 5; k = &m; return (j+m); } void main(void) { static int i =0; i++; i = bar(i) + x; }
Fat Shogun
asked
Aug 18, 2024
by
Fat Shogun
8.2k
points
Mathematics
high-school
1
answer
4
votes
220k
views
Ask a Question
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.
9.5m
questions
12.2m
answers
Other Questions
“What does it mean when we “rework” copyrighted material?”
The book shows how to add and subtract binary and decimal numbers. However, other numbering systems are also very popular when dealing with computers. The octal (base 8) numbering system is one of these.
Seven basic internal components found in a computer tower
describe an advance in technology that makes life more enjoyable. what discoveries contribute to this technology?
Disadvantages of using animation in advertising? advantages and disadvantages of using animation for education? advantages and disadvantages of using animation in entertainment?
Twitter
WhatsApp
Facebook
Reddit
LinkedIn
Email
Link Copied!
Copy
Search QAmmunity.org