1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
malfutka [58]
3 years ago
11

11.

Computers and Technology
1 answer:
kodGreya [7K]3 years ago
6 0

Answer:

The basic difference between finite and infinite is the number of times it runs and ends. The loop is basically a set of instructions that keeps repeating itself.

The finite loop ends after running for a finite times. This body of finite loop will stop executing after certain condition is reached. Hence the finite loop body keeps executing itself finite number of times.

An infinite loop keeps running and repeating itself endlessly.This loop never ends. This loop can be the result of an error in a program. For example when no stopping or exit condition is specified in the program.

Explanation:

Example of finite loop:

Lets take for loop as an example:

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

{ cout<<i<<endl; }

Now the loop starts from i=0

Next it enters the body of loop to execute the statement: cout<<i; which means that the value of i is displayed on the output screen.

This loop keeps executing until the value of i exceeds 5.

At first iteration 0 is printed on the output screen, at second iteration 1, at third iteration 2, at fourth iteration 3, fifth iteration 4, sixth iteration 5. After each of these iterations, the value of i is incremented by 1.

When 5 is printed, then at the next iteration the specified condition i.e. i<=5 gets false as the value of i now becomes 6 after incremented by 1.

So the loop stops running. So this means that loop ran for finite times and stopped after the a certain condition is reached. The output is:

0

1

2

3

4

5

Example of infinite loop:

Lets take while loop:

int i = 6;

    while (i >=5)

    {         cout<< i;

             i++;     }

In the above example, the loop will run infinite times. Here the value of i is initialized to 6. Then while loop is used which checks the condition which is the value of i is greater than or equal to 5. If the condition is true, the body of the loop starts executing which prints the value of i. Lets see what happens at each iteration:

1st iteration: i>=5 is True because i=6 and 6 is greater than 5. The program control enters the body of loop. The statement cout<<i prints 6. Next the value of i is incremented by 1 and it becomes 7.

2nd iteration: i>=5 is True because i=7 and 7 is greater than 5. The program control enters the body of loop. The statement cout<<i prints 7. Next the value of i is incremented by 1 and it becomes 8.

This loop will repeat itself infinite times and never stops as i will always have value greater than 5. So this is the example of infinite loop.

You might be interested in
John's father specifically asked him to get a magnetic disk from the store in his neighborhood. What should John buy?
Korvikt [17]

Answer:

A floppy disk

Explanation:

A floppy disk uses a thin sheet of magnetic material to store data. It would make the most sense as the other choices use an entirely different system.

5 0
3 years ago
The simple mixture of flour and water​
kykrilka [37]

Answer:

Batter is a simple mixture of flour and water is used to make crepes and pancakes. It is also used to coat fruit for fritters.

8 0
2 years ago
Read 2 more answers
Refer to the color wheel to identify the color scheme.
morpeh [17]
C) monochromatic
Hope this helps!

btw make me brainliest?
4 0
4 years ago
2
Elza [17]

A is the correct answer.

Hope this helps you!

3 0
4 years ago
Read 2 more answers
These steps describe saving a newly created file.
leva [86]
1. Click on the save icon 2. Name the file 3. select save from the file menu
8 0
3 years ago
Read 2 more answers
Other questions:
  • This type of connection uses radio waves to connect devices on a network.
    9·2 answers
  • Francis works in the human resources division of a large oil and gas company in Texas. Francis' tasks include maintaining payrol
    14·1 answer
  • You need to test a condition and then execute one set of statements if the condition is true. If the condition is false, you nee
    9·1 answer
  • Which NSX feature would enhance their security so that this doesn’t happen again?
    15·1 answer
  • Given the following characteristics for a magnetic disk pack with 10 platters yielding 18 recordable surfaces (not using the top
    14·1 answer
  • Cell references in a formula are called _____.<br> a. assumptionsc. numbersb. valuesd. content
    11·1 answer
  • Angle parking spaces are generally entered at an angle about __________ from the curb.
    8·2 answers
  • Software licensed using the Open Software Initiative (OSI) definition
    5·2 answers
  • How do I log into PGCPS?
    14·1 answer
  • Animation timing is does not affect the
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!