Question

Discuss why it is necessary to use repetitive statement, and use segment codes to demonstrate your...

Discuss why it is necessary to use repetitive statement, and use segment codes to demonstrate your understanding of repetitive statement. Explain why you are choosing one of the following three statements in your code. a) for/foreach statement b) while/until statement c) do while/do until statement. Provide examples. You are welcome to do your own research or/and give feedback on others' comments.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Repetitive statements are an Integral part of any programming language, as they allow you to use a certain piece of code again and again , where multiple iterations are required to be performed for a fixed no. Of times.

Writing repetitive statements allows you to perform the function until it satisfies the requirements set by the user.

There are several repetitive statements such as:

1. For

2. While

3. Do-while

There use and how and why they are used are given below.

For ( I=0; I<500; I++)

{ a= a+6;

}

This statement will keep performing the specified statement inside the for until it satisfies the condition of being less than 500.

It is used when we know the specific amount of time a iteration or function has to be performed .

2.

While( a<5)

{ I++;}

The statement will continue to execute till the value is less than 5, and exit as soon as it doesn't satisfy the condition.

It will execute only of the condition is satisfied. If not, it exits .

3. .

Do {

A= A++;

}

While (I<4)

{ A++; }

In the do-while statements, the conditions will execute at least once as specified under the do and then after one execution it will check for conditions under the while statement and proceed accordingly.

The do statements will execute at least once , irrespective of further statement.

Hope that helps .

Regards

Add a comment
Know the answer?
Add Answer to:
Discuss why it is necessary to use repetitive statement, and use segment codes to demonstrate your...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What is the role of ethics within corporate governance? Why do corporations establish codes of ethics?...

    What is the role of ethics within corporate governance? Why do corporations establish codes of ethics? Do you think they are effective? Why or why not? Should there be repercussions for failure to adhere to corporate ethics policy? Why or why not? Next, research the code of ethics for a company of your choosing. You can usually find this info on the company’s webpage, or with a simple Google search of “company x” and “code of ethics.” (Be sure to...

  • Part 1: After reflecting on your program learning – and in your own words – write...

    Part 1: After reflecting on your program learning – and in your own words – write (2-3 paragraphs) about how you will demonstrate the following, within a professional environment. Include responses to the following topics within a professional environment: a. What is the importance of providing and receiving feedback from peers? b. How might you recognize peers’ skills, experience, creativity, and contributions? c. Why should you disagree tactfully? d. Why might you need to check for understanding while collaborating with...

  • In each question, be sure to support facts and give examples to demonstrate learning. In answering...

    In each question, be sure to support facts and give examples to demonstrate learning. In answering questions, you must define and explain the organizational behavior terms that you use. 1. You own and operate a hardware store in Maumelle, Arkansas. Following a major tornado in town, you see that there is a demand for generators. You have purchased the 200 in your shop over time for between $150 and $175, and you sell them for $250 each except for sales,...

  • This discussion asks you to compose and post a research proposal for your final project assignment,...

    This discussion asks you to compose and post a research proposal for your final project assignment, and offer feedback to others on their projects. Your Formal Research Proposal should consist of the following items: topic and medium of your project — will you be researching a workplace problem or innovation, identifying your specific topic of interest, and will you be presenting your findings in a traditional website or a blog intended audience — what kind of reader do you hope...

  • Knowing that firms change with the implementation of new IT applications, discuss why organizations sometimes resist...

    Knowing that firms change with the implementation of new IT applications, discuss why organizations sometimes resist changes in information systems. Include organizational factors to consider when planning a new system in your discussion. What role do you think management plays in organizational resistance to change? Do you think the role of management in systems development is important or not? Provide support for your answers. discuss professional codes of conduct by associations of professions such as the American Medical Association (AMA),...

  • Please Help!!! Requirements: Use an external CSS & JS file, no internal or inline styles &...

    Please Help!!! Requirements: Use an external CSS & JS file, no internal or inline styles & scripts Please comment your JS to demonstrate your understanding of what is happening Create a form with at least 2 inputs and a submit button A good example would be First Name, Last Name, and Age. Use JS to provide the user with some feedback on the values they enter or choose with your inputs To do this you will need create a function...

  • 1) In C++, come up with a scenario where you should use a catch(...). What should...

    1) In C++, come up with a scenario where you should use a catch(...). What should you do in that catch block? 2) Describe in detail any problems you see in the following code. void funcOne() {      Dog *ptr = new Dog;      cout << “Presenting the result of a division: “ << funcDivide();      delete ptr; } int funcDivide() {     int a, b;     cin >> a >> b;     if (b == 0)       throw “Divide...

  • Application Exercises – 1.15“Personal Mission Statement and Code of Conduct” Introduce yourself to the class by...

    Application Exercises – 1.15“Personal Mission Statement and Code of Conduct” Introduce yourself to the class by articulating your own personal statement. Do a bit of research first (as the textbook suggests). Then, in your initial DB post write a few sentences to introduce yourself and to mention the sources or examples you relied on to compose your personal mission statement and code of conduct. Then, attach your document. Application Exercis 1.15 Personal Mission Statement and Code of Conduct (LO 1.3)...

  • In the following questions and activity, you demonstrate your understanding of the file-system interface and implementation....

    In the following questions and activity, you demonstrate your understanding of the file-system interface and implementation. These are critical features of the way we use computers. Questions: 1. Some operating systems keep track of the file type, while others leave it up to the user. Which is better and why? 2. In most operating systems, the subdirectories can be read and changed by users, just as ordinary files can be. What is a protection problem that could arise? How can...

  • While you should not treat this as a question-answer exercise, and while it is not necessary...

    While you should not treat this as a question-answer exercise, and while it is not necessary for you to answer all of the following questions, a good term paper will fully address and elaborate on most of the questions, in order to demonstrate knowledge and understanding of this topic. What are the main tenets (propositions) of labeling theory? With what type of thinking (or what school of thought) is labeling theory associated? Do the above-referenced research studies offer empirical support...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT