Search:

Type: Posts; User: chakana101

1. Thread: Another recursive method! pretty stuck on this one.

by chakana101
Replies
3
Views
268

Re: Another recursive method! pretty stuck on this one.

I understand how sum(10-1) returns 9 - sum(9-1) and so on...but a little confused on the second part, where you mention the return values in line 9....where does the return 2+1 come from and so on?
2. Thread: Another recursive method! pretty stuck on this one.

by chakana101
Replies
3
Views
268

Another recursive method! pretty stuck on this one.

write a recursive method sum that calculates the sum of the integers between 1 and n, using the following recursive definition: The sum of the values from 1 to n is n plus the sum of the values from...

by chakana101
Replies
1
Views
248

int [] [] mat = new int [3] [4];

for (int row = 0; row < mat.length; row ++ )
{

for ( int col = 0; col < mat[0].length; col++ )
{

if ( row < col )
mat...
4. Thread: confused on this recursive method example

by chakana101
Replies
2
Views
161

confused on this recursive method example

public int mystery (int k )
{

if ( k ==1 ) return 0;

else return ( 1 + mystery(k/2) );
}
5. Thread: Difficulty understanding code with for loop?

by chakana101
Replies
1
Views
345

Difficulty understanding code with for loop?

import java.util.Scanner;

public class Multiples
{

public static void main (String [] args)
{

final int PER_LINE = 5;
int value, limit, mult,...

by chakana101
Replies
5
Views
308

Re: Question about do loops?

I see lol glad to know i'm not crazy haha, thanks for the help guys! and it's actually my textbook haha

by chakana101
Replies
5
Views
308

Re: Question about do loops?

this is the answer in the back of the book:

6.10:

the code contains an infinite loop. The numbers 10, 11, 12 and so on will be printed until the program is terminated or until the number gets...

by chakana101
Replies
5
Views
308

Question about do loops?

in the case of:

int low = 10 , high =0

do
{
9. Thread: Questions about if statements and if-else statements

by chakana101
Replies
5
Views
345

Re: Questions about if statements and if-else statements

So using something else as a similar example:

if (score >= 90) grade = 'A';
if (score >= 80) grade = ' B ';
if (score >= 70 ) grade = 'C';
if (score >= 60 ) grade = 'D';
10. Thread: Questions about if statements and if-else statements

by chakana101
Replies
5
Views
345

Re: Questions about if statements and if-else statements

The way my professor presented the problem in the practice exam, is without the brackets. Because they weren't shown, are they implied to be there? Would it still produce the same output without the...
11. Thread: Questions about if statements and if-else statements

by chakana101
Replies
5
Views
345

Questions about if statements and if-else statements

I have an exam on monday on java programming and i'm still a bit confused about a certain question involving nested if statements, the question is:

What is the output of the following code:
...
Results 1 to 11 of 11