Search:

Type: Posts; User: chakana101

Search: Search took 0.18 seconds.

  1. 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. 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...
  3. confused about this for loop/ array?

    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. confused on this recursive method example

    public int mystery (int k )
    {

    if ( k ==1 ) return 0;

    else return ( 1 + mystery(k/2) );
    }
  5. 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,...
  6. Replies
    5
    Views
    107

    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
  7. Replies
    5
    Views
    107

    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...
  8. Replies
    5
    Views
    107

    Question about do loops?

    in the case of:




    int low = 10 , high =0

    do
    {
  9. 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';
    else grade =...
  10. 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. 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