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
How many fixes are available for Adobe Photoshop CS4 (64 Bit)?
arsen [322]

Answer:

There are three (3) fixes in adobe cs4.

Explanation:

Adobe photoshop cs4 is a version of the creative cloud's professional graphic applications used to edit pictures, design interfaces, make graphical illustrations, draw and animate the drawings, etc.

It can be installed in several computer operating system platforms like linux, mac and windows. The adobe photoshop cs4 doesn't support the windows installation and might run into several issues. There are other issues in other supported platforms, but unlike for windows, there are three fixes for these problems.

4 0
3 years ago
What is the full form of RAM. ​
grigory [225]

Random Access Memory

7 0
2 years ago
Read 2 more answers
Walt has selected data in a worksheet and inserted a chart. However, the chart is inserted right on top of the data set, and he
Marianna [84]

Answer:

Click View and zoom into the worksheet so the chart is easily visible.

Explanation:

5 0
2 years ago
Read 2 more answers
Picture related to cyber safety
Fantom [35]

Answer:

?????

Explanation:

4 0
2 years ago
Read 2 more answers
Which of the following describes a decision support system (DSS)?
levacccp [35]

Answer:

B.

Explanation:

8 0
2 years ago
Read 2 more answers
Other questions:
  • Who is affected by electronuc theft of a song ?
    14·2 answers
  • Katie created a web site that automatically scales to fit a cell phone. What kind of design did Katie use?
    12·2 answers
  • What is the magnitude of the largest positive value you can place in a bool? a char? an int? a float?
    14·1 answer
  • 1. What are the biggest risks when using the public Internet as a Wide Area Network (WAN) or transport for remote access to your
    6·1 answer
  • Who was one of the founders of the location sharing site Foursquare​
    10·1 answer
  • Which part of a window lets you see a fileâs contents without opening the file?
    9·1 answer
  • How does technology improve convenience, but impact our privacy?
    8·1 answer
  • When seeking information on the Internet about a variety of subjects, the most
    7·2 answers
  • Write a program that will generate 100 integers between 0 and 1000. Store the even numbers in a sorted linked list called evens.
    12·1 answer
  • What is human data,
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!