Ask Question
17 January, 04:12

Explain how for loops can be used to work effectively with elements in an array?

+3
Answers (1)
  1. 17 January, 07:47
    0
    There are three types of loops in programming languages which are as following:-

    for. while. do while.

    The syntax for all the three loops is different. You will see mostly for loop used with the arrays because they are easy to implement.

    the syntax of for loop is : -

    for (int i=initial value; condition; i++)

    {

    body

    }

    In for loops you only have to write the conditions in only line else is the body of the loop.

    for example:-

    for array of size 50 printing the each element

    for (int i=0; i<50; i++)

    {

    cout<
    }

    You have to initialize i with 0 and the condition should be i
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Explain how for loops can be used to work effectively with elements in an array? ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers