coding for nested loop problem
i want to run nested loop with two variables 'p' and 'q'
outer loop is for 'p' and inner loop is for 'q'
the problem is q should run for all values when ('q' not equal to 'p') and neglect the simulation of its contents when q=p
is there any simple method to do this other than using "for loop"
for p = 1:10
 for q = 1:10
 if p ~= q
 ...
 end
 end
end
without a for loop:
x = rand(10, 10);
index = (1:10) ~= (1:10).';
mean(x(index)) % mean of elements, which are not on main diagonal
Your explanation is not consistent. You state that the user is to enter a range as in "find me all numbers between x and y that are divisible by both 3 and 4." Later you state that you "input value 120 10 times". That is inconsistent with the problem so either the problem is stated incorrectly or you are not inputting the expected data. Decide what is the correct problem then write it up in pseudo-code before you write the actual code.


If a range is expected, make sure you test that it is a valid range (x <= y). so if you want to be able to run them as separate runs, you’ll still need some way of communicating between them. one mechanism we provide for that is by serializing daml values as json through the --input-file and --output-file options to daml script. so in your case, you should make sure that the … I will preface this by saying that I don't know Java at all. I touched upon it in school 20+ years ago, but I've been doing PHP ever since.


However, on line 27, you say that if the input passed in is a double, execute this code block *blah*.


The user enters -1.


Is -1 not a double? It is a valid double, and therefore the code block executes, setting the priceFromUser to be -1 and adding it to the list.


Then, when the loop starts back up again on line 23, priceFromUser is now -1, so the loop breaks and prints the tally.


Also, note you're definining this constant SENTINEL variable, but you're not actually using it anywhere in your code.


Perhaps do something like this instead, changing the while loop into a do-while loop:



```
System.out.println("Please enter item price to start, since there needs to be at least 1 item:");

do
{

        // Keep asking for a price until the user enters a valid price
        while (!in.hasNextDouble())               
        {
                trash=in.nextLine(); //throw away the input 
                System.out.println("You did not enter a valid price. Please try again:");
        }

        priceFromUser=in.nextDouble(); //read value from user
        list.add(priceFromUser); //add valid price to the list            

          System.out.println("Please enter another item price, or enter -1 to quit.");

} while (priceFromUser != SENTINEL)
```

Note this isn't valid code because I'm not a Java programmer, but hopefully it helps you out a bit. dear student

kindly refer to the link for the similar query :


https://www meritnation
com/ask-answer/question/q-23-and-24-q23-give-the-formula-of-each-of-the-follow/the-p-block-elements/11940305

regards the q value for the nernst equation can be determined by  the overall reaction of the cell notation. recall that q is the reaction quotient which can be calculated as:determine the overall reaction using the mnemonic for cell notation, abc:step 1. determine the overall reaction and find the anode and cathode. the anode (one being oxidized) and cathode (one being reduced). using the mnemonic, it appears that the anode is zn(s) while the cathode is cu(s).step 2. write the equation where the anode, zn (s), is being oxidized to to zn2+ (from zn(no3)2) and the cathode, cu (s), is produced by reduction of cu2+ (from cu(no3)2zn (s) - anode; cu (s) - cathode zn (s) + cu2+ (aq) → cu (s) + zn2+ (aq)step 3. setup the q expression using the concentration of zn2+ and cu2+ provided. note that (s) and (l) are not included in q or keq expressionsstep 4. plugin q to lnq ln(q) = ln(1) = 0 answer is 0 You need to give the user the option of typing in a value that represents that there are no more values to enter. Perhaps give a prompt like:



```
Please enter a value.  Enter -999999 if you have no more values [B]:[/B]
```

As for the ten (or fewer) values, you should probably have an array and a loop instead of ten separate variable names and ten separate cin statements. So you're looking at something like this:



```
double dValue[10];
    int numEntries = 0;
    double sum = 0;
    
    while (numEntries < 10)
    {
          cout << "Enter number (-999999 to stop) : ";
          cin >> dValue[numEntries];
          // check whether dValue[numEntries] == -999999
          // if so, short-circuit the loop with the "break" command
            
          // increment numEntries
          // adjust sum
    }
```

As a side note, I picked -999999 as the value to represent no more values because



1. It's an integer, so it can be represented exactly as a double (no round-off error using == to compare).
2. It's a number that, chances are, people wouldn't actually want to add, so it's sort of "out of the way". Chances are, few people want to add -999999. If they do, they can't use this program! never mind, finally solved it. i called this.engine.runrenderloop while it’s already running, therefore causing the speed to run twice, because it added a loop/callback the 2nd time.

all i need to do for the ‘resume’ part of my function is to always call this.engine.stoprenderloop() before i call t… 1) p(x) = 1/x2 + 1 if x ≤ 3 it is clear that x= 3 is included, so you have to use this function.2) loo k at table d, and compare the given information with the data written inside the table. no i can’t, but you can look up the solution on the [hints page](http://forum.freecodecamp.org/t/freecodecamp-challenge-guide-profile-lookup/18259) if you’re ready to give up.

all you need to change is the placement of this line:

return "no such contact"

right now it’s inside the for loop (before the closing }), it needs to be outside the for loop (after the closing }) ?solution 23cq


a) equation for loop abgefa is (35.5)i1 + (6..25 = 21 v
b) equation for loop cbgedc is ( 9.25i2 - ( 6.25i3 = +15 v