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 do you properly turn off a computer?
Ugo [173]

Answer:

with the power button or do the sleep or shut down

and by the type of computer

Explanation:

sry if its wrong

have a good day:)

-XxMissNobodyxX

7 0
2 years ago
Read 2 more answers
If you tap or click the increase font size button too many times and make the font size too big, you can tap or click the _____
ioda
You can click the ctrl and minus  button at the same time
7 0
4 years ago
Write a program that accepts a whole number as input, multiplies that number by 12, and then outputs the product.
lesya692 [45]

try:

   num = int(input("Enter a number: "))

   print(12*num)

except ValueError:

   print("Please enter a number!")

I wrote my code in python 3.8

6 0
3 years ago
Read 2 more answers
After a CPU decodes an instruction, what is the next step in the execution cycle?
Nat2105 [25]

Answer: E) The CPU executes the instruction by performing ALU operations.

Explanation: The execution cycle is of three stages namely; fetch, decode and execute. These are the functions that the CPU carries out from the time of boot-up up until it's shut down.

At the fetch stage, the computer retrieves program instructions from its memory register, at the decode stage; the decoders interprets the instructions from the instructions register and then the next stage will be the executions, at this stage; the interpreted instructions are then passed to relevant function units of the CPU to carry out the required instructions.

E.g mathematical and logic functions are passed on the ARITHMETIC AND LOGIC UNIT(ALU) to perform.

8 0
3 years ago
How do I make my own extension for chrome?
Alexeev081 [22]
Open your browser and click the 3 strip bar in the conner and then look toward the bottom and click settings and it will open a new browser and then you are going to look at the left side and you will see extension click it and there you go...

4 0
3 years ago
Other questions:
  • List two reasons why buying a computer is no easy task?
    7·1 answer
  • Kayla is working on a document for her business meeting. She wants to save this document with another name. Which option should
    5·1 answer
  • What is institutional advertising focused on promoting?
    8·1 answer
  • What language below is used to view and manipulate data that is stored in a relational database?
    6·1 answer
  • 4.8 Code Practice: Question 1<br> I need help
    13·1 answer
  • In what way can a costume be deleted ?
    13·1 answer
  • What is this on G00gel Documents , how do I fix it?
    15·1 answer
  • Info, and Contact Us. She will create a hierarchy of page elements and revise the style sheets. In this case, the Home page cont
    5·1 answer
  • Which of the following is/are used in multimedia?
    14·1 answer
  • A scanner connected to your mac is giving problems and you suspect corrupted device drivers. What should you do first? second?.
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!