Question

In the script below, where should I insert the break command so that the code produces...

In the script below, where should I insert the break command so that the code produces the following output:
10
    11

    12

    26
 
 
a = 10; for i=a:i+10 if( a<13 ) ...(1)... disp(a); a = a+1; ...(2)... else disp(a*2); ...(3)... end ...(4)...  end

a.

(4)

b.

(1)

c.

(3)

d.

(2)

Homework Answers

Answer #1

Answer:

c.

(3)

Explanation:

The given script is:

a = 10; for i=a:i+10 if( a<13 ) ...(1)... disp(a); a = a+1; ...(2)... else disp(a*2); ...(3)... end ...(4)...  end

For the first three passes of the for loop, the first if block will be executed and 10 11 12 will be printed. For the fourh pass the program will go inside the else statement where the value of a is 13 currently and 13*2 i.e. 26 will be printed. After that we should give the "break" keyword in order to stop execution at that time according to the given problem.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Take a look at the code below. What is the problem with the code? Change the...
Take a look at the code below. What is the problem with the code? Change the code so that it will run properly. (10 points) i = -6 # Code the while loop while i != 0 :     print("Output 1")     if i>0 :           print("Output 2")     else :           print("Output 3")    print(offset)
i want to complete this code to insert a new node in the middle of list...
i want to complete this code to insert a new node in the middle of list (take a node data from user, search the node and insert new node after this node). this is the code #include <iostream> #include <stdlib.h> using namespace std ; struct Node{                int data;                Node *link ;}; struct Node *head=NULL, *tail=NULL; /* pointers to Node*/ void InsertFront(); void InsertRear(); void DeleteFront(); void DeleteRear(); int main(){                int choice;                do{                               cout << "1:...
The code I have so far:    public static boolean validPass(String sPass)    {    boolean...
The code I have so far:    public static boolean validPass(String sPass)    {    boolean y=false;    if(sPass.length()>10)    {    int i,j=0,k=0;    char c;    for(i=0;i<sPass.length();i++)    {              c=sPass.charAt(i);    if(c>='A' && c<='Z')    {    j++;    }    else if(c>='a' && c<='z');    else if (!(sPass.contains("&") || sPass.contains("-")    || sPass.contains("%") || sPass.contains("_")    ||sPass.contains("^")||sPass.contains("@")));    else if(c>='0' && c<='9')    {    k++;    }    else    {   ...
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 extern char **environ;    5 void output(char *a[], char...
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 extern char **environ;    5 void output(char *a[], char *b[]) { 6 int c = atoi(a[0]); 7 for (int i = 0; i < c && b[i]; ++i) { 8 printf("%s", b[i]+2); 9 } 10 } 11 12 void main(int argc, char *argv[]) { 13      14 switch (argc) { 15 case 1: 16 for (int i = 0; environ[i]; ++i) {    17 printf("%s\n", environ[i]); 18 } 19 break; 20 default: 21 output(argv +...
I need the actual code for this... I found a similar response but it was not...
I need the actual code for this... I found a similar response but it was not thorough enough. Problem Prerequisites: None Suppose that a scientist is doing some important research work that requires her to use rabbits in her experiments. She starts out with one adult male rabbit and one adult female rabbit. At the end of each month, a pair of adult rabbits produces one pair of offspring, a male and a female. These new offspring will take one...
JAVA / I KNOW THERE IS MORE THAN ONE QUESTION BUT THEY ARE SO EASY FO...
JAVA / I KNOW THERE IS MORE THAN ONE QUESTION BUT THEY ARE SO EASY FO YOU I NEED YOUR HELP PLEASE HELP ME. I WILL GIVE UPVOTE AND GOOD COMMENT THANK YOU SO MUCH !!! QUESTION 1 What is the output after the code executes? Assume there are no syntax errors and the code will compile. int x = 10; do { System.out.println ( x ); x -= 3; } while (x > 0); A. 10 7 4 1...
Could you script in Matlab : Script Name General Algorithm AddNewEmployee Display all of the ID...
Could you script in Matlab : Script Name General Algorithm AddNewEmployee Display all of the ID numbers currently in use Read in a new ID number If the ID number read in is already in use Report this fact End this script Else (this is a new ID number) Read in: Years with the company Salary Vacation days Sick days Add this new employee to the database (by appending a new row to the end of the EmployeeData matrix) Note...
Java Script I need the code to produce these 3 output. I can only get it...
Java Script I need the code to produce these 3 output. I can only get it to produce input #3 I need it to produce the following: // Input #1: // http://www.example.com // Output // http://www.example.com // Input #2: // http://www.example.com?name=r2d2 // Output // http://www.example.com // name: r2d2 // Input #3: // http://www.example.com?name=r2d2&email=r2d2%40me.com&human=no // Output // http://www.example.com // name: r2d2 // email: [email protected] // human: no THIS IS WHAT I HAVE SO FAR: HTML <!DOCTYPE html> <html lang="en"> <head> <meta...
The first script you need to write is login.sh, a simple script that you might run...
The first script you need to write is login.sh, a simple script that you might run when you first log in to a machine. We'll expand this script later, but for now it should include your name, username, hostname, current directory, and the current time. Here is some sample output to help guide you. Note that the bolded lines that start with "[user@localhost ~]$" are the terminal prompts where you type in a command, not part of the script. Of...
PHP Question: _____________________________________________ Write the PHP code to list out all of the dates of the...
PHP Question: _____________________________________________ Write the PHP code to list out all of the dates of the current month and assign them to their given days. As an example, for the month of October 2020, the output should look something like this: October 2020       Monday: 5, 12, 19, 26 Tuesday: 6, 13, 20, 27 Wednesday: 7, 14, 21, 28 Thursday: 1, 8, 15, 22, 29 Friday: 2, 9, 16, 23, 30 Saturday: 3, 10, 17, 24, 31 Sunday: 4,...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT