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
What naming scheme identifies the rows in a worksheet?
UNO [17]
The naming scheme would be b


3 0
3 years ago
Read 2 more answers
Which of the following ways is NOT one of the ways that the census is
Liono4ka [1.6K]

Answer: By internet

Explanation:

5 0
3 years ago
HELP!!!
jeyben [28]

Answer:

A. a tool tip

Explanation:

6 0
3 years ago
Read 2 more answers
The next generation ip version and successor to ipv4 is called what? ipv5 ipv6 iana ssl
Olenka [21]
I study IT,it was Ipv 6 in our textbook
4 0
4 years ago
You have decided to remove a recently installed feature which method can you use to remove this feature
Aliun [14]
If it is on the desktop screen you just right click on the icon and select delete. from there if you're on a windows computer it goes to your recycle bin then you right click the recycle bin and a little rectangle pops up an in that rectangle it says clear recycle bin and once you press that all of the stuff that was in there is deleted. now if your on a computer that has chrome os installed you just go to the files screen and right click what you want to delete and click delete and it's gone. 
6 0
3 years ago
Other questions:
  • Consider the following class: public class Dog { private String name; private String breed; public String getName() { return nam
    11·1 answer
  • A program that will accept the ages of girls and boys and calculate the total and average age​
    15·1 answer
  • 6. Assume there are three small caches, each consisting of four one-word blocks. One cache is fully associative, a second is two
    5·1 answer
  • I need help, thank you
    7·1 answer
  • What is a narrative?
    7·2 answers
  • Match the parts of the software applications with what they do.
    15·1 answer
  • which kind of system software tells the computer how to communicate with peripherals, such as a printer or scanner?
    7·1 answer
  • All variables are----------------------------------------------- help please
    7·2 answers
  • Select the correct answer.
    13·1 answer
  • Int r=6;<br> int v=20;<br> System.out.println( r % v );
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!